-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
How to scale the radius property of each bubble in a vue-chartjs bubble chart #205
Comments
Hey @johnboc Well this._chart is only available after the first initialization. See here https://github.com/apertureless/vue-chartjs/blob/develop/src/BaseCharts/Bar.js#L78 So you can't really access it in other methods before the first renderChart() is called. But generally I don't see a problem achieving a custom bubble radius. However you are passing Like in your example radius: function(context) {
var value = context.dataset.data[context.dataIndex];
var size = context.chart.width;
var base = Math.abs(value.v) / 1000;
return (size / 24) * base;
} |
Thanks, but what I don't understand is how to access context to be able to access the data points when the calcRadius function is called.
Your code example works in chart.js but I can't see how to replicate it in vue-chartjs. |
Well you just pass the |
Great - many thanks |
I am using the latest version of chart.js which is 2.9.3. While using this function I am getting error the following error |
I am trying to scale the radius property of each bubble in a vue-chartjs bubble chart.
I have been trying to replicate the example at https://github.com/chartjs/Chart.js/blob/master/samples/scriptable/bubble.html but I cannot see how to obtain the data value to pass to the function. In my code below d should be the data value of the bubble.
I have tried accessing the chart.js instance using this._chart but this doesn't seem to be available when setting the chart options.
Any help much appreciated.
The text was updated successfully, but these errors were encountered: