-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[BUG] Not correct view of graphs #3491
Comments
Closing as duplicate of #2873. We initially had this clipping implemented but it caused a lot of problems with points that fall right at the edge. The simplest and most performant clipping method is to simply do a rectangle that is the chart area. The 'best' solution would be to project all the points on the edges onto the rectangle and clip along an arbitrary path. Unfortunately, this is painful. IE has no support for https://developer.mozilla.org/en-US/docs/Web/API/Path2D which means we can't even build the path once and then just reclip later, we'd need to build the path each time we render (every animation frame) and this is going to cause problems. If you're okay with the clipping of points at the edges then adding the following plugin will work just fine. Chart.plugins.register({
beforeDatasetsDraw: function(chartInstance) {
var ctx = chartInstance.chart.ctx;
var chartArea = chartInstance.chartArea;
ctx.save();
ctx.beginPath();
ctx.rect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
ctx.clip();
},
afterDatasetsDraw: function(chartInstance) {
chartInstance.chart.ctx.restore();
},
}); |
Implements clipping of items outside the chart area. Resolves chartjs#3506 chartjs#3491 chartjs#2873
Expected Behavior
Current Behavior
We made a values for graph and add min and max values
Area chart don't cut values and show over the category scales. Please follow the link to view issue
Possible Solution
Steps to Reproduce (for bugs)
Context
Environment
https://jsfiddle.net/RoundArh/Lkpaz9b6/2/
The text was updated successfully, but these errors were encountered: