txbm / angular-chartjs

Directive set for the ChartJS library. Supports data bindings and attribute-level specification for chart specific options. The only Angular ChartJS module that supports ALL chart options as HTML5 attributes :)
MIT License
146 stars 38 forks source link

setting scaleStepWidth dynamically? #11

Open crolfe opened 10 years ago

crolfe commented 10 years ago

I'm trying to set scaleStepWidth dynamically on a line graph (based on a maximum value in my dataset), and am having difficulty getting the chart to recognize that I've done so.

If I hard code a value for scaleStepWidth in the options object (plus scaleStepOverride=true and scaleSteps=20), the chart scales exactly as expected. If I try to set the chart options after I've received the dataset in the controller, then the chart appears to display using the default settings.

Is this happening because the view needs to be recompiled to reflect the changes to the options?

txbm commented 10 years ago

Possibly yes. Also could be something about the auto-sizing interfering with the scaling options.

This will be fixed soon as I am going to remove that drawing logic entirely since it is now supported natively by ChartJS, hang with me :)

crolfe commented 10 years ago

Sure thing. I found a workaround using ng-repeat after the dataset is ready, but that feels like cheating :)

txbm commented 10 years ago

Yeah that confirms it's a watch/apply issue though thank you.

txbm commented 9 years ago

I have narrowed down the exact cause of this issue and it will be fixed shortly.