Skip to content

Commit cfe4557

Browse files
boolean field, if not the last series, throws error when clicking advanced options
#733 (comment)
1 parent 12669ba commit cfe4557

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/Sidebar/SeriesSettings.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ class SeriesSettings extends Component {
6060

6161
{ Object.keys( settings.series )
6262
.map( ( i, index ) => {
63+
let indexToFormat = parseInt( i );
64+
65+
if ( 'tabular' !== type ) {
66+
indexToFormat = index;
67+
}
68+
6369
i++;
70+
6471
return (
6572
<PanelBody
6673
title={ series[i].label }
@@ -121,9 +128,9 @@ class SeriesSettings extends Component {
121128
<TextControl
122129
label={ __( 'Format' ) }
123130
help={ __( 'Enter custom format pattern to apply to this series value.' ) }
124-
value={ settings.series[index].format }
131+
value={ settings.series[indexToFormat].format }
125132
onChange={ e => {
126-
settings.series[index].format = e;
133+
settings.series[indexToFormat].format = e;
127134
this.props.edit( settings );
128135
} }
129136
/>
@@ -148,9 +155,9 @@ class SeriesSettings extends Component {
148155
label={ __( 'Date Format' ) }
149156
help={ __( 'Enter custom format pattern to apply to this series value.' ) }
150157
placeholder="dd LLLL yyyy"
151-
value={ settings.series[index].format }
158+
value={ settings.series[indexToFormat].format }
152159
onChange={ e => {
153-
settings.series[index].format = e;
160+
settings.series[indexToFormat].format = e;
154161
this.props.edit( settings );
155162
} }
156163
/>

0 commit comments

Comments
 (0)