python-highcharts icon indicating copy to clipboard operation
python-highcharts copied to clipboard

changing plot options of a series in drop down menu of Settings does not work

Open matsvandecavey opened this issue 10 years ago • 3 comments

I can't change the plot options color and lineWidth after the plot is made. I want to change s1 = dict(name='List data', data=[1,2,5,9,6,3,4,8]) to s1 = dict(name='List data', data=[1,2,5,9,6,3,4,8], color='#2b908f', lineWidth=4) in the settings. I want to do this because I use pd.DataFrames as input data, so I can't modify color= and lineWidth=

matsvandecavey avatar Sep 04 '15 06:09 matsvandecavey

I could work around this if I convert the DataFrame to a dictionary first Which function is used to convert a DataFrame to the dictionary you use to plot?

matsvandecavey avatar Sep 04 '15 06:09 matsvandecavey

I found the function for the workaround.

from charts import core

series=core.df_to_series(df) column_dict = {v:i for i,v in enumerate(df)} column = 'Tz_ref' series[column_dict[column]]['color']='#2b908f' series[column_dict[column]]['lineWidth']=10

charts.plot(series)

matsvandecavey avatar Sep 04 '15 06:09 matsvandecavey

@matsvandecavey With the current implementation this is the only way to do it. To be able to dynamically update the colors would require some javascript coding.

arnoutaertgeerts avatar Sep 11 '15 10:09 arnoutaertgeerts