kyper-data / python-highcharts

A simple translation layer between Python and Javascript for Highcharts projects (highcharts, highmaps, and highstocks).
MIT License
393 stars 190 forks source link

Spline Chart issue #45

Open ccjasia opened 6 years ago

ccjasia commented 6 years ago

Hi ,

I'm new to highchart using python. The syntax I apply to generate highchart as follows: hs.add_data_set(listline2,series_type='spline',pointStart=inst['dtime'][len(inst)-190],pointIntervalUnit='day',zoneAxis='x',zones=[{'value': inst['dtime'][len(inst)-190], 'color': '#395C84'}, {'value': inst['dtime'][len(inst)-150], 'color': '#B0171F'}, {'value': inst['dtime'][len(inst)-100], 'color': '#63BE7B'}])

When I try to execute my python script to generate 'spline' chart using highchart, it shows the following : May I know what's the issue ??

zones [{'value': Timestamp('2017-03-20 00:00:00'), 'color': '#395C84'}, {'value': Timestamp('2017-05-22 00:00:00'), 'color': '#B0171F'}, {'value': Timestamp('2017-08-01 00:00:00'), 'color': '#63BE7B'}]

Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev\pydev_run_in_console.py", line 52, in run_file pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2017.3.1\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "G:/cd/Invest/Learn/TTCF/homework/TradingStrategy/Backtest/TestHighchartSpline.py", line 249, in executeBackTest() File "G:/cd/Invest/Learn/TTCF/homework/TradingStrategy/Backtest/TestHighchartSpline.py", line 243, in executeBackTest e.write_chart(grp, int(sys.argv[3])) File "G:/cd/Invest/Learn/TTCF/homework/TradingStrategy/Backtest/TestHighchartSpline.py", line 48, in write_chart hs.add_data_set(listline2,series_type='spline',pointStart=inst['dtime'][len(inst)-190],pointIntervalUnit='day',zoneAxis='x',zones=[{'value': inst['dtime'][len(inst)-190], 'color': '#395C84'}, {'value': inst['dtime'][len(inst)-150], 'color': '#B0171F'}, {'value': inst['dtime'][len(inst)-100], 'color': '#63BE7B'}]) File "C:\ProgramData\Anaconda3\lib\site-packages\highcharts\highstock\highstock.py", line 198, in add_data_set series_data.options().update(SeriesOptions(series_type=series_type, kwargs).options()) File "C:\ProgramData\Anaconda3\lib\site-packages\highcharts\highstock\highstock_types.py", line 395, in init self.process_kwargs(kwargs,series_type=series_type,supress_errors=supress_errors) File "C:\ProgramData\Anaconda3\lib\site-packages\highcharts\highstock\highstock_types.py", line 495, in process_kwargs if not supress_errors: raise OptionTypeError("Option Type Mismatch: Expected: %s" % allowed_args[k]) TypeError: not all arguments converted during string formatting**