-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added events to smoothie charts #116
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice feature, but as it stands this PR cannot be merged. It removes a bunch of functionality others depend upon. I also think the implementation could be improved to have better performance, as discussed in comments below.
if (typeof dataSet[i][1] === 'string' ) { | ||
context.moveTo(x, 0); | ||
context.lineTo(x, dimensions.height); | ||
context.fillStyle = seriesOptions.strokeStyle; | ||
context.fillText(dataSet[i][1], x + 5, 10); | ||
} else { | ||
context.moveTo(x, y); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than do this type check on every point on every series, it'd be clearer and faster to create a new series type for these events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the function be exactly the same ? I just think it doubles the code unnecessarily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final outcome would be the same, but it's a lot more work to test the type on every single point on all series. Smoothie is light and fast. Currently this cost would be paid by everyone, regardless of whether they use these events. Using a new SmoothieEventSeries
type avoids that cost.
c1820e6
to
b542507
Compare
b542507
to
bc47a4b
Compare
@francobottero Have you considered updating this to use a separate TimeSeries type? I for one would like to see this feature added. |
@cinderblock feel free to create a new PR if you have the bandwidth. |
It's important to say that events have to go on a separate
TimeSeries
than the rest of the data or else, they will interfere with the chart.Events will look something like this :