← All changes
|
classes/Visualizer/Gutenberg/src/Components/ChartSelect.js
+7
-18
3.10.3
→
3.4.2
View file →
| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | import PanelButton from './PanelButton.js'; |
| 23 | 23 | |
| 24 | 24 | import merge from 'merge'; |
| 25 | 25 | |
| 26 | -import { compact, formatDate, isValidJSON, formatData } from '../utils.js'; | |
| 26 | +import { compact, formatDate, isValidJSON } from '../utils.js'; | |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * WordPress dependencies |
| 30 | 30 | */ |
| @@ -56,23 +56,17 @@ | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | render() { |
| 59 | 59 | |
| 60 | - let chartVersion = 'undefined' !== typeof google ? google.visualization.Version : 'current'; | |
| 61 | - | |
| 62 | 60 | let chart, footer; |
| 63 | 61 | |
| 64 | 62 | let data = formatDate( JSON.parse( JSON.stringify( this.props.chart ) ) ); |
| 65 | 63 | |
| 66 | - if ( 0 <= [ 'gauge', 'tabular', 'timeline' ].indexOf( this.props.chart['visualizer-chart-type']) ) { | |
| 67 | - if ( 'DataTable' === data['visualizer-chart-library']) { | |
| 64 | + if ( 0 <= [ 'gauge', 'table', 'timeline', 'dataTable' ].indexOf( this.props.chart['visualizer-chart-type']) ) { | |
| 65 | + if ( 'dataTable' === data['visualizer-chart-type']) { | |
| 68 | 66 | chart = data['visualizer-chart-type']; |
| 69 | 67 | } else { |
| 70 | - chart = this.props.chart['visualizer-chart-type']; | |
| 71 | - if ( 'tabular' === chart ) { | |
| 72 | - chart = 'table'; | |
| 73 | - } | |
| 74 | - chart = startCase( chart ); | |
| 68 | + chart = startCase( this.props.chart['visualizer-chart-type']); | |
| 75 | 69 | } |
| 76 | 70 | } else { |
| 77 | 71 | chart = `${ startCase( this.props.chart['visualizer-chart-type']) }Chart`; |
| 78 | 72 | } |
| @@ -117,9 +111,8 @@ | ||
| 117 | 111 | <ManualData chart={ this.props.chart } editChartData={ this.props.editChartData } /> |
| 118 | 112 | |
| 119 | 113 | <PanelButton |
| 120 | 114 | label={ __( 'Advanced Options' ) } |
| 121 | - className="visualizer-advanced-options" | |
| 122 | 115 | icon="admin-tools" |
| 123 | 116 | onClick={ () => this.setState({ route: 'showAdvanced' }) } |
| 124 | 117 | /> |
| 125 | 118 | |
| @@ -139,9 +132,9 @@ | ||
| 139 | 132 | isBack={ true } |
| 140 | 133 | /> |
| 141 | 134 | |
| 142 | 135 | { 'showAdvanced' === this.state.route && |
| 143 | - <Sidebar chart={ this.props.chart } attributes={ this.props.attributes } edit={ this.props.editSettings } /> | |
| 136 | + <Sidebar chart={ this.props.chart } edit={ this.props.editSettings } /> | |
| 144 | 137 | } |
| 145 | 138 | |
| 146 | 139 | { 'showPermissions' === this.state.route && |
| 147 | 140 | <ChartPermissions chart={ this.props.chart } edit={ this.props.editPermissions } /> |
| @@ -148,13 +141,13 @@ | ||
| 148 | 141 | } |
| 149 | 142 | </InspectorControls> |
| 150 | 143 | } |
| 151 | 144 | |
| 152 | - <div className="visualizer-settings__chart" data-chart-type={ chart }> | |
| 145 | + <div className="visualizer-settings__chart"> | |
| 153 | 146 | |
| 154 | 147 | { ( null !== this.props.chart ) && |
| 155 | 148 | |
| 156 | - ( 'DataTable' === data['visualizer-chart-library']) ? ( | |
| 149 | + ( 'dataTable' === chart ) ? ( | |
| 157 | 150 | <DataTable |
| 158 | 151 | id={ this.props.id } |
| 159 | 152 | rows={ data['visualizer-data'] } |
| 160 | 153 | columns={ data['visualizer-series'] } |
| @@ -161,9 +154,8 @@ | ||
| 161 | 154 | options={ data['visualizer-settings'] } |
| 162 | 155 | /> |
| 163 | 156 | ) : ( '' !== data['visualizer-data-exploded'] ? ( |
| 164 | 157 | <Chart |
| 165 | - chartVersion={ chartVersion } | |
| 166 | 158 | chartType={ chart } |
| 167 | 159 | rows={ data['visualizer-data'] } |
| 168 | 160 | columns={ data['visualizer-series'] } |
| 169 | 161 | options={ |
| @@ -171,13 +163,11 @@ | ||
| 171 | 163 | merge( compact( this.props.chart['visualizer-settings']), JSON.parse( this.props.chart['visualizer-settings'].manual ) ) : |
| 172 | 164 | compact( this.props.chart['visualizer-settings']) |
| 173 | 165 | } |
| 174 | 166 | height="500px" |
| 175 | - formatters={ formatData( data ) } | |
| 176 | 167 | /> |
| 177 | 168 | ) : ( |
| 178 | 169 | <Chart |
| 179 | - chartVersion={ chartVersion } | |
| 180 | 170 | chartType={ chart } |
| 181 | 171 | rows={ data['visualizer-data'] } |
| 182 | 172 | columns={ data['visualizer-series'] } |
| 183 | 173 | options={ |
| @@ -185,9 +175,8 @@ | ||
| 185 | 175 | merge( compact( this.props.chart['visualizer-settings']), JSON.parse( this.props.chart['visualizer-settings'].manual ) ) : |
| 186 | 176 | compact( this.props.chart['visualizer-settings']) |
| 187 | 177 | } |
| 188 | 178 | height="500px" |
| 189 | - formatters={ formatData( data ) } | |
| 190 | 179 | /> |
| 191 | 180 | ) |
| 192 | 181 | ) } |
| 193 | 182 | |