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