Skip to content

Commit ebc5eff

Browse files
manual configuration example specific to the library
1 parent 7cd860f commit ebc5eff

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

classes/Visualizer/Render/Sidebar.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ protected function _renderManualConfigDescription() {
167167
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
168168
}
169169

170+
/**
171+
* Add the correct example for the manual configuration box.
172+
*/
173+
protected function _renderManualConfigExample() {
174+
return '{
175+
"vAxis": {
176+
"ticks": [5, 10, 15, 20],
177+
"titleTextStyle": {
178+
"color": "red"
179+
},
180+
"textPosition": "in"
181+
}
182+
}';
183+
}
184+
170185
/**
171186
* Renders chart advanced settings group.
172187
*
@@ -183,24 +198,13 @@ protected function _renderAdvancedSettings() {
183198

184199
self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
185200
$this->_renderManualConfigDescription();
186-
$example = '
187-
{
188-
"vAxis": {
189-
"ticks": [5, 10, 15, 20],
190-
"titleTextStyle": {
191-
"color": "red"
192-
},
193-
"textPosition": "in"
194-
}
195-
}';
196-
197201
self::_renderTextAreaItem(
198202
esc_html__( 'Configuration', 'visualizer' ),
199203
'manual',
200204
$this->manual,
201205
sprintf(
202206
esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ),
203-
'<br><code>' . $example . '</code>'
207+
'<br><code>' . $this->_renderManualConfigExample() . '</code>'
204208
),
205209
'',
206210
array( 'rows' => 5 )

classes/Visualizer/Render/Sidebar/ChartJS.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,16 @@ protected function _renderManualConfigDescription() {
347347
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
348348
}
349349

350+
/**
351+
* Add the correct example for the manual configuration box.
352+
*/
353+
protected function _renderManualConfigExample() {
354+
return '{
355+
"cutoutPercentage": 5,
356+
"rotation": 60
357+
}';
358+
}
359+
350360
/**
351361
* Renders chart view settings group.
352362
*

0 commit comments

Comments
 (0)