Skip to content

Commit cacc6bf

Browse files
Provide the correct link depending on the chart-type in manual configuration
1 parent 413ccc3 commit cacc6bf

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

classes/Visualizer/Render/Page/Data.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ protected function _renderSidebarContent() {
6767
),
6868
admin_url( 'admin-ajax.php' )
6969
);
70+
71+
$type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
7072
?>
71-
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span>
73+
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-type="<?php echo $type; ?>"></span>
7274
<iframe id="thehole" name="thehole"></iframe>
7375
<ul class="viz-group-wrapper full-height">
7476
<li class="viz-group viz-group-category open" id="vz-chart-source">

classes/Visualizer/Render/Sidebar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ protected function _renderAdvancedSettings() {
165165

166166
self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
167167
self::_renderSectionStart();
168-
self::_renderSectionDescription( __( 'Configure the graph by providing configuration variables right from the', 'visualizer' ) . ' <a href="https://developers.google.com/chart/interactive/docs/reference" target="_blank">Google Visualization</a> API.' );
168+
self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', '</a>' ) . '</span>' );
169169

170170
$example = '
171171
{

js/frame.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
$(document).ready(function () {
1414
init_permissions();
1515

16+
// update the manual configuation link to point to the correct chart type.
17+
var type = $('#visualizer-chart-id').attr('data-chart-type');
18+
var chart_type_in_api_link = type + 'chart';
19+
switch (type) {
20+
case "gauge":
21+
case "table":
22+
case "timeline":
23+
chart_type_in_api_link = type;
24+
break;
25+
}
26+
27+
if($('span.viz-gvlink').length > 0) {
28+
$('span.viz-gvlink').html($('span.viz-gvlink').html().replace('?', chart_type_in_api_link));
29+
}
30+
1631
$('.type-radio').change(function () {
1732
$('.type-label-selected').removeClass('type-label-selected');
1833
$(this).parent().addClass('type-label-selected');

0 commit comments

Comments
 (0)