arnoutaertgeerts / python-highcharts

Use highchart.js to make plots in Python and IPython notebooks
http://nbviewer.ipython.org/github/arnoutaertgeerts/python-highcharts/blob/master/Tutorial.ipynb
Other
134 stars 31 forks source link

Annotations on charts or use flags #53

Open epoot opened 8 years ago

epoot commented 8 years ago

Hi Arnout,

Can you point me to an example that shows how to add annotations to a timeseries chart (highstock)?

I have been struggling to get this to work, but so far nothing yet.

The data is in the following format: values flags Timestamp
2014-02-28 00:00:00 1160994 OK 2014-02-28 00:15:00 0 FAULTY_ZERO 2014-02-28 00:30:00 0 FAULTY_ZERO 2014-02-28 00:45:00 1163902 OK 2014-02-28 01:00:00 1164244 OK

This is what I have been doing so far: df_result = validation.execute("zero_reads") print df_result['flags'].value_counts() flags = dict(type="flags", data=[dict(x=str(k), title=v[1]) for k, v in df_result.iterrows() if v[1]!='OK']) options = dict(title="test", annotations=flags) charts.plot(df_result, options=options, show='inline', stock=True)

I want to show the non "OK" flags only (from the flags column) with a label showing up just above the value in the chart.

thanks for your help!

Regards,

Edwin