@@ -92,6 +92,7 @@ def __init__(self, *args, **kwargs):
92
92
self ._chart_data = {}
93
93
self ._chart_count = 0
94
94
self ._chart_label = {}
95
+ self ._chart_xcount = 0
95
96
self ._chart_first_series = {}
96
97
self ._chart_series_count = {}
97
98
self ._tour_steps = {}
@@ -4368,6 +4369,24 @@ def save_presentation(
4368
4369
show_notes_str ,
4369
4370
interval_ms ))
4370
4371
4372
+ # Remove duplicate ChartMaker library declarations
4373
+ chart_libs = (
4374
+ """
4375
+ <script src="%s"></script>
4376
+ <script src="%s"></script>
4377
+ <script src="%s"></script>
4378
+ <script src="%s"></script>
4379
+ """ % (
4380
+ constants .HighCharts .HC_JS ,
4381
+ constants .HighCharts .EXPORTING_JS ,
4382
+ constants .HighCharts .EXPORT_DATA_JS ,
4383
+ constants .HighCharts .ACCESSIBILITY_JS ))
4384
+ if the_html .count (chart_libs ) > 1 :
4385
+ chart_libs_comment = '<!-- HighCharts Libraries Imported -->'
4386
+ the_html = the_html .replace (chart_libs , chart_libs_comment )
4387
+ # Only need to import the HighCharts libraries once
4388
+ the_html = the_html .replace (chart_libs_comment , chart_libs , 1 )
4389
+
4371
4390
saved_presentations_folder = constants .Presentations .SAVED_FOLDER
4372
4391
if saved_presentations_folder .endswith ("/" ):
4373
4392
saved_presentations_folder = saved_presentations_folder [:- 1 ]
@@ -4622,15 +4641,14 @@ def __create_highchart(
4622
4641
subtitle = subtitle .replace ("'" , "\\ '" )
4623
4642
unit = unit .replace ("'" , "\\ '" )
4624
4643
self ._chart_count += 1
4644
+ # If chart_libs format is changed, also change: save_presentation()
4625
4645
chart_libs = (
4626
4646
"""
4627
4647
<script src="%s"></script>
4628
4648
<script src="%s"></script>
4629
4649
<script src="%s"></script>
4630
4650
<script src="%s"></script>
4631
- <script src="%s"></script>
4632
4651
""" % (
4633
- constants .JQuery .MIN_JS ,
4634
4652
constants .HighCharts .HC_JS ,
4635
4653
constants .HighCharts .EXPORTING_JS ,
4636
4654
constants .HighCharts .EXPORT_DATA_JS ,
@@ -4682,7 +4700,7 @@ def __create_highchart(
4682
4700
chart_figure = (
4683
4701
"""
4684
4702
<figure class="highcharts-figure">
4685
- <div id="chartcontainer %s"></div>
4703
+ <div id="chartcontainer_num_ %s"></div>
4686
4704
<p class="highcharts-description">%s</p>
4687
4705
</figure>
4688
4706
""" % (self ._chart_count , chart_description ))
@@ -4693,7 +4711,7 @@ def __create_highchart(
4693
4711
"""
4694
4712
<script>
4695
4713
// Build the chart
4696
- Highcharts.chart('chartcontainer %s', {
4714
+ Highcharts.chart('chartcontainer_num_ %s', {
4697
4715
credits: {
4698
4716
enabled: false
4699
4717
},
@@ -5054,6 +5072,9 @@ def extract_chart(self, chart_name=None):
5054
5072
axis += "'%s'," % label
5055
5073
axis += "], crosshair: false},"
5056
5074
the_html = the_html .replace ("xAxis: { }," , axis )
5075
+ self ._chart_xcount += 1
5076
+ the_html = the_html .replace (
5077
+ "chartcontainer_num_" , "chartcontainer_%s_" % self ._chart_xcount )
5057
5078
return the_html
5058
5079
5059
5080
############
0 commit comments