-
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
Need help: Shadows on line charts #4977
Comments
@Ashot-KR I think you could use a plugin that hooks Extending const ShadowLineElement = Chart.elements.Line.extend(...);
Chart.elements.Line = ShadowLineElement; |
Extending line works(see the fiddle), i also create a new chart type: Chart.defaults.ShadowLine = Chart.defaults.line
Chart.controllers.ShadowLine = Chart.controllers.line.extend({
datasetElementType: ShadowLineElement
}) and create a chart with this type new Chart(document.getElementById('canvas'), {
type: 'ShadowLine'
…
} Didn't notice it here just to be shorter.
Thanks, i'll give it a try |
Sorry about that, I missed that part of your fiddle. Trying the plugin hooks and see how they work. I modified your fiddle a bit to remove the shadow after drawing the line element. https://jsfiddle.net/dces93wv/ |
@etimberg you're my savior. Thanks a lot! |
I'm trying to draw line chart with shadows. The only way i found to override
ctx.stroke
method and add shadow properties to it, but in this case shadow appears also on gridlines and points.Example: https://jsfiddle.net/1geu4zd5/2/
I tried to implement shadows by extending line element
Is there any way to draw shadow only for lines?
The text was updated successfully, but these errors were encountered: