← All changes
|
classes/Visualizer/Gutenberg/src/Components/Sidebar/VerticalAxisSettings.js
+14
-36
3.10.13
→
3.2.1
View file →
| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | Component, |
| 8 | 8 | Fragment |
| 9 | 9 | } = wp.element; |
| 10 | 10 | |
| 11 | -const { ColorPalette } = wp.blockEditor || wp.editor; | |
| 11 | +const { ColorPalette } = wp.editor; | |
| 12 | 12 | |
| 13 | 13 | const { |
| 14 | 14 | BaseControl, |
| 15 | 15 | ExternalLink, |
| @@ -17,10 +17,8 @@ | ||
| 17 | 17 | SelectControl, |
| 18 | 18 | TextControl |
| 19 | 19 | } = wp.components; |
| 20 | 20 | |
| 21 | -import { getColorCode } from '../../utils.js'; | |
| 22 | - | |
| 23 | 21 | class VerticalAxisSettings extends Component { |
| 24 | 22 | constructor() { |
| 25 | 23 | super( ...arguments ); |
| 26 | 24 | } |
| @@ -86,11 +84,11 @@ | ||
| 86 | 84 | <BaseControl |
| 87 | 85 | label={ __( 'Base Line Color' ) } |
| 88 | 86 | > |
| 89 | 87 | <ColorPalette |
| 90 | - value={ settings.hAxis.baselineColor } | |
| 88 | + value={ settings.vAxis.baselineColor } | |
| 91 | 89 | onChange={ e => { |
| 92 | - settings.hAxis.baselineColor = getColorCode( e ); | |
| 90 | + settings.vAxis.baselineColor = e; | |
| 93 | 91 | this.props.edit( settings ); |
| 94 | 92 | } } |
| 95 | 93 | /> |
| 96 | 94 | </BaseControl> |
| @@ -101,15 +99,15 @@ | ||
| 101 | 99 | <ColorPalette |
| 102 | 100 | value={ settings.vAxis.textStyle.color || settings.vAxis.textStyle } |
| 103 | 101 | onChange={ e => { |
| 104 | 102 | settings.vAxis.textStyle = {}; |
| 105 | - settings.vAxis.textStyle.color = getColorCode( e ); | |
| 103 | + settings.vAxis.textStyle.color = e; | |
| 106 | 104 | this.props.edit( settings ); |
| 107 | 105 | } } |
| 108 | 106 | /> |
| 109 | 107 | </BaseControl> |
| 110 | 108 | |
| 111 | - { ( -1 >= [ 'bar' ].indexOf( type ) ) && ( | |
| 109 | + { ( -1 >= [ 'column' ].indexOf( type ) ) && ( | |
| 112 | 110 | <Fragment> |
| 113 | 111 | |
| 114 | 112 | <TextControl |
| 115 | 113 | label={ __( 'Number Format' ) } |
| @@ -130,9 +128,9 @@ | ||
| 130 | 128 | </p> |
| 131 | 129 | |
| 132 | 130 | <p> |
| 133 | 131 | { __( 'For date axis labels, this is a subset of the date formatting ' ) } |
| 134 | - <ExternalLink href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax"> | |
| 132 | + <ExternalLink href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax"> | |
| 135 | 133 | { __( 'ICU date and time format.' ) } |
| 136 | 134 | </ExternalLink> |
| 137 | 135 | </p> |
| 138 | 136 | |
| @@ -152,15 +150,11 @@ | ||
| 152 | 150 | > |
| 153 | 151 | |
| 154 | 152 | <TextControl |
| 155 | 153 | label={ __( 'Count' ) } |
| 156 | - help={ __( 'The approximate number of vertical gridlines inside the chart area. You can specify a value of -1 to automatically compute the number of gridlines, 0 or 1 to draw no gridlines, or 2 or more to only draw gridline. Any number greater than 2 will be used to compute the minSpacing between gridlines.' ) } | |
| 157 | - value={ settings.vAxis.gridlines ? settings.vAxis.gridlines.count : '' } | |
| 154 | + help={ __( 'The number of Vertical gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines.' ) } | |
| 155 | + value={ settings.vAxis.gridlines.count } | |
| 158 | 156 | onChange={ e => { |
| 159 | - if ( ! settings.vAxis.gridlines ) { | |
| 160 | - settings.vAxis.gridlines = {}; | |
| 161 | - } | |
| 162 | - | |
| 163 | 157 | settings.vAxis.gridlines.count = e; |
| 164 | 158 | this.props.edit( settings ); |
| 165 | 159 | } } |
| 166 | 160 | /> |
| @@ -168,14 +162,10 @@ | ||
| 168 | 162 | <BaseControl |
| 169 | 163 | label={ __( 'Color' ) } |
| 170 | 164 | > |
| 171 | 165 | <ColorPalette |
| 172 | - value={ settings.vAxis.gridlines ? settings.vAxis.gridlines.color : '' } | |
| 166 | + value={ settings.vAxis.gridlines.color } | |
| 173 | 167 | onChange={ e => { |
| 174 | - if ( ! settings.vAxis.gridlines ) { | |
| 175 | - settings.vAxis.gridlines = {}; | |
| 176 | - } | |
| 177 | - | |
| 178 | 168 | settings.vAxis.gridlines.color = e; |
| 179 | 169 | this.props.edit( settings ); |
| 180 | 170 | } } |
| 181 | 171 | /> |
| @@ -190,14 +180,11 @@ | ||
| 190 | 180 | > |
| 191 | 181 | |
| 192 | 182 | <TextControl |
| 193 | 183 | label={ __( 'Count' ) } |
| 194 | - help={ __( 'Specify 0 to disable the minor gridlines.' ) } | |
| 195 | - value={ settings.vAxis.minorGridlines ? settings.vAxis.minorGridlines.count : '' } | |
| 184 | + help={ __( 'The number of Vertical minor gridlines between two regular gridlines.' ) } | |
| 185 | + value={ settings.vAxis.minorGridlines.count } | |
| 196 | 186 | onChange={ e => { |
| 197 | - if ( ! settings.vAxis.minorGridlines ) { | |
| 198 | - settings.vAxis.minorGridlines = {}; | |
| 199 | - } | |
| 200 | 187 | settings.vAxis.minorGridlines.count = e; |
| 201 | 188 | this.props.edit( settings ); |
| 202 | 189 | } } |
| 203 | 190 | /> |
| @@ -205,13 +192,10 @@ | ||
| 205 | 192 | <BaseControl |
| 206 | 193 | label={ __( 'Color' ) } |
| 207 | 194 | > |
| 208 | 195 | <ColorPalette |
| 209 | - value={ settings.vAxis.minorGridlines ? settings.vAxis.minorGridlines.color : '' } | |
| 196 | + value={ settings.vAxis.minorGridlines.color } | |
| 210 | 197 | onChange={ e => { |
| 211 | - if ( ! settings.vAxis.minorGridlines ) { | |
| 212 | - settings.vAxis.minorGridlines = {}; | |
| 213 | - } | |
| 214 | 198 | settings.vAxis.minorGridlines.color = e; |
| 215 | 199 | this.props.edit( settings ); |
| 216 | 200 | } } |
| 217 | 201 | /> |
| @@ -227,13 +211,10 @@ | ||
| 227 | 211 | |
| 228 | 212 | <TextControl |
| 229 | 213 | label={ __( 'Maximun Value' ) } |
| 230 | 214 | help={ __( 'The maximum vertical data value to render.' ) } |
| 231 | - value={ settings.vAxis.viewWindow ? settings.vAxis.viewWindow.max : '' } | |
| 215 | + value={ settings.vAxis.viewWindow.max } | |
| 232 | 216 | onChange={ e => { |
| 233 | - if ( ! settings.vAxis.viewWindow ) { | |
| 234 | - settings.vAxis.viewWindow = {}; | |
| 235 | - } | |
| 236 | 217 | settings.vAxis.viewWindow.max = e; |
| 237 | 218 | this.props.edit( settings ); |
| 238 | 219 | } } |
| 239 | 220 | /> |
| @@ -240,13 +221,10 @@ | ||
| 240 | 221 | |
| 241 | 222 | <TextControl |
| 242 | 223 | label={ __( 'Minimum Value' ) } |
| 243 | 224 | help={ __( 'The minimum vertical data value to render.' ) } |
| 244 | - value={ settings.vAxis.viewWindow ? settings.vAxis.viewWindow.min : '' } | |
| 225 | + value={ settings.vAxis.viewWindow.min } | |
| 245 | 226 | onChange={ e => { |
| 246 | - if ( ! settings.vAxis.viewWindow ) { | |
| 247 | - settings.vAxis.viewWindow = {}; | |
| 248 | - } | |
| 249 | 227 | settings.vAxis.viewWindow.min = e; |
| 250 | 228 | this.props.edit( settings ); |
| 251 | 229 | } } |
| 252 | 230 | /> |