I am trying to update my chart data using chart.update(). In this case, my chart variable is called scatterChart:
scatterChartData.datasets[0].data.push({ x: +xx, y: +yy });
console.log(scatterChartData.datasets[0]);
window.scatterChart.update();
This code is supposed to run when I click a button. However, it doesn’t work. What am I missing? The full project can be seen at http://next.plnkr.co/edit/McN3qxt5caOZr77M
Thanks in advance for helping!
In window.onload function add:
window.scatterChart = scatterChart
Related
I am trying to always enable all the tooltips for Bubble chart using react-charjs-2 plugin
I tried various approaches but none of them work with the latest version of the plugin
Would appreciate some advice, Thank you! :)
I tried the all possible approaches, including the following ones, but was unable to achieve the results
Tried the following:
Chart JS: Always show tooltips in a multi dataset line chart
By default it is not possible to show all the tooltips at once, if you really want it you will need to use the external (html) tooltip.
The easyer way is to use the datalabels plugin: https://chartjs-plugin-datalabels.netlify.app/samples/charts/bubble.html
I see in the ChartJS docs (https://www.chartjs.org/docs/latest/) how to style the x-axis as a whole, but I'd like to style a single label.
I have an example codepen here https://codepen.io/jsilver951/pen/pozOBzy?editors=1000 where I've tried to add the attribute in before the update function but nothing is working.
Incorrect
lineChart.options.scales.xAxes[0].ticks.fontColor = "hsl(0,100%,50%)";
Does anyone know how or even if this is possible?
This issue of changing the style of each tick was raised here https://github.com/chartjs/Chart.js/issues/2442.
A working solution was created by #bevingtongroup1 with an example of how to use it by #kneeki here2.
The issue is now closed but I'm not sure if its fully implemented into the latest chart.js version. Hope this helps solve your issue!
I m working on charts using the chart.js library. I want to show image gallery like a carousel on click of any segment of pie/doughnut chart. I'm not able to find the proper solution. Please suggest some solution
If I understand correctly what you are trying is to trigger an event after user clicks on chart segment. chart.js has this prototype method getElementAtEvent(); See the documentation.
It seems as a good place to start - you could create some function to open image gallery and call it there.
And the gallery/slider implementation is a separate issue, but if you are using some of the popular ui libraries some of them have a solution for that already. Bootstrap, for example has carousel, and JQuery has many plugins for that purpose. Here are some examples. Hope this helps...
I'm trying to use Polymer's google-chart component to create a geo chart with the marker display mode, however, the component keeps showing an error of google.load is not a function.
I think the chart is being bound to the DOM before a call to the Google Maps API is completed but I'm not totally sure. Has anyone else had success making marker or text geo charts with the google-chart component?
Here's a repro of the issue using the marker and text geochart examples: https://jsbin.com/mewahibane/edit?html,output
This seems to be an issue with the google-chart library.
Recently there was a change where a google-chart-loader element was added to deal with some recent issues with the google charts library.
Maybe this causes an issue with the GeoChart library.
As a workaround add this line <script type="text/javascript" src="https://www.google.com/jsapi"></script> above the google-chjart import. This should fix it. See here:
https://jsbin.com/gejipiqehu/edit?html,output
What about this code ? >> https://jsbin.com/tabahu/edit?html,output
i am trying to add marker on google-chart. just copy code from this documentation.
https://developers.google.com/chart/interactive/docs/gallery/geochart#marker-geocharts
Has anyone any suggestions on how to align the status text on the QProgressBar in Qt? By default in Windows it appears to the right of the bar but I'd prefer to place it either above the bar or within the bar itself without having to extend the object and implement a status label myself.
Screenshot below:
Yet another approach would be to set the alignment of the status text through QProgressBar::setAlignment:
barProgress_->setAlignment(Qt::AlignCenter);
You can use stylesheets to modify the look of the progress bar. Here's an example: http://qt-project.org/doc/qt-4.8/stylesheet-examples.html#customizing-qprogressbar
Thanks to vipw's suggestion above I have achieved the effect I'm looking for with a simple call to setStyleSheet() as follows (there is no spreadsheet currently defined for this app and it's practically finished so the call to this method will save me having to include an entire new css file):
barProgress_->setStyleSheet(QString::fromUtf8("text-align: center;"));
The result is:
Anyway thanks for the help.