-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Expected Behavior
I'm trying to make a chart that can switch between multiple views. In this situation, it's changing the type of chart from 'line' to 'horizontalBar' or 'radar'. I've created a simple pen script that would showcase the issue I'm currently having.
I expected after updating the config variable ( that contains all the labels, data and options ) to help render a new Chart with the different type.
Current Behavior
What i've noticed is that I can set a variable
let var = { type: "horizontalBar", data: [ data goes here ] };
and I could use that to generate a new functional Chart. The problem is, the title, positioning of the legend and everything else gets reset to defaults and the title is missing. I'd like to keep all of those settings intact, but if I'd use a similar object as initially, the chart no longer displays any values.
Possible Solution
Steps to Reproduce
On https://codepen.io/derains/pen/jOVywBv I've created a sample of the code that would showcase the problem.
- If you click the "Horizontal Update" - this is the one that is expected to work as intended but it renders an empty Chart.
- If you click on "Radar Update" - this will work but the INITIAL display of the chart title and legend gets messed up.
Context
Environment
- Chart.js version: CDN ( 2.8.0 ) - https://cdn.jsdelivr.net/npm/chart.js@2.8.0
- Browser name and version: Google Chrome Version 88.0.4324.150 (Official Build) (64-bit)
- Link to your project: https://codepen.io/derains/pen/jOVywBv