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

Support for multiple thresholds #21

Closed
wants to merge 1 commit into from

Conversation

osteenbergen
Copy link

chartist_thresholds

- options.thresholds = [100, 75, 50, 25];
- Added some maskPadding to prevent clipping on the bottom and top of the graph
- Added prefix to support multiple graphs on a single page
@gionkunz
Copy link
Owner

Hey thanks! I appreciate the feature! Will look into the PR soon.

@robkaper
Copy link

Precisely what I need, would love for this to be included.

@xuancongwen
Copy link

@gionkunz Any chance of this getting a code review?

@maxbond2
Copy link

maxbond2 commented May 6, 2020

Used this plugin mod for one of my project - it saved a lot of time for me! @osteenbergen, thank you very much!

One note. When several charts initialised with different thresholds, you have to manually set uniqe mask names for each chart!

@chris-hippo
Copy link

Do you have some example code for this? I'm struggling to set up multiple thresholds and style each differently, I only have ct-threshold-below and ct-threshold-above to work with?

@osteenbergen
Copy link
Author

osteenbergen commented May 25, 2020

Depending on the prefixThreshold setting you have area-<index> available.

option.thresholds = [75, 50, 25]

  • above: 75 and higher
  • area-0: between 75 and 50
  • area-1: between 50 and 25
  • below: 25 and lower
.ct-point {
  stroke-width: 5px;
}
.ct-point.ct-threshold-above {
  stroke: green;
}
.ct-point.ct-threshold-area-0 {
  stroke: yellow;
}
.ct-point.ct-threshold-area-1 {
  stroke: orange;
}
.ct-point.ct-threshold-below {
  stroke: red;
}

@osteenbergen
Copy link
Author

@gionkunz Its been a year, any luck on merging this PR? Do you require improvements?

@markterrill
Copy link

great stuff! Seems quite a lot of the chartist repo's are not being maintained

@osteenbergen
Copy link
Author

Closing this PR as this project is not maintained....

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.

7 participants