Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

francobottero
Copy link

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 :
changes

Copy link
Collaborator

@drewnoakes drewnoakes left a 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.

smoothie.d.ts Outdated Show resolved Hide resolved
smoothie.js Outdated Show resolved Hide resolved
smoothie.js Outdated Show resolved Hide resolved
smoothie.js Outdated Show resolved Hide resolved
smoothie.js Outdated Show resolved Hide resolved
Comment on lines +909 to +934
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);
}
Copy link
Collaborator

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.

Copy link
Author

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

Copy link
Collaborator

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.

smoothie.js Outdated Show resolved Hide resolved
@cinderblock
Copy link

@francobottero Have you considered updating this to use a separate TimeSeries type? I for one would like to see this feature added.

@drewnoakes
Copy link
Collaborator

@cinderblock feel free to create a new PR if you have the bandwidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants