G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class HtmlDashCreator(object):
  2.     def __init__():
  3.         ## add head
  4.         self.html = '''
  5.        <script src="https://code.highcharts.com/stock/highstock.js"></script>
  6.        <script src="https://code.highcharts.com/stock/modules/data.js"></script>
  7.        <script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
  8.        <script src="https://code.highcharts.com/stock/modules/export-data.js"></script>
  9.        '''
  10.         self.chart_counter = 1
  11.  
  12.     def add_chart(chart_name, chart_series_name, data_url):
  13.         chart_id = self.chart_counter
  14.         self.chart_counter += 1
  15.         template = '''
  16.        <script>
  17.  
  18.        Highcharts.getJSON('{data_url}', function (data) {
  19.            // Create the chart
  20.            Highcharts.stockChart('{chart_id}', {
  21.  
  22.  
  23.                rangeSelector: {
  24.                    selected: 1
  25.                },
  26.  
  27.                title: {
  28.                    text: '{chart_name}'
  29.                },
  30.  
  31.                series: [{
  32.                    name: '{series_name}',
  33.                    data: data,
  34.                    tooltip: {
  35.                        valueDecimals: 5
  36.                    }
  37.                }]
  38.            });
  39.        });
  40.  
  41.        </script>
  42.        <div id='{chart_id}' style="height: 400px; min-width: 310px"></div>
  43.        '''
  44.         self.html += template.format(chart_id=chart_id, chart_series_name=chart_series_name, data_url=data_url)
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top