wcharczuk / go-chart

go chart is a basic charting library in go.
MIT License
3.99k stars 324 forks source link

Empty values in TimeSeries #121

Open eelcovb opened 5 years ago

eelcovb commented 5 years ago

Hi,

Thanks for a great graph lib! Not really an issue, just something I've been unable to find. When drawing a TimeSeries, missing time/value pairs are drawn as straight lines from the previous and the next known data. So for example say I have value 5 on Monday, missing Tuesday and Wednesday and value 10 on Thursday it will draw a line between 5 and 10 for those missing days. Is there a way to disable this and just have it not draw anything when data is missing?

Thank you!

jhelberg commented 2 months ago

I'm implementing a fix at the moment. It is a feature where char.Style.StrokeMaxSpanGap. If a gap is less or eauql than this value, a line is drawn, otherwise a gap is visible. The unit is the same as the unit for X-axis. Looks neat and is exaclty what I need for my charts. It works for timeseries (unit is nanosecond) and other series as well. Will submit a PR soon.