Skip to content

Commit 72bbfe2

Browse files
Merge pull request #322 from contactashish13/issue-321
Provide the correct link depending on the chart-type in manual configuration
2 parents 75cfb83 + cacc6bf commit 72bbfe2

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
@@ -68,8 +68,10 @@ protected function _renderSidebarContent() {
6868
),
6969
admin_url( 'admin-ajax.php' )
7070
);
71+
72+
$type = get_post_meta( $this->chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
7173
?>
72-
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>"></span>
74+
<span id="visualizer-chart-id" data-id="<?php echo $this->chart->ID; ?>" data-chart-type="<?php echo $type; ?>"></span>
7375
<iframe id="thehole" name="thehole"></iframe>
7476
<ul class="viz-group-wrapper full-height">
7577
<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
@@ -175,7 +175,7 @@ protected function _renderAdvancedSettings() {
175175

176176
self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
177177
self::_renderSectionStart();
178-
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.' );
178+
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>' );
179179

180180
$example = '
181181
{

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)