Chart js with problems when using too many series - charts

I am using angular chart in one application which basically makes use of chart js. The version of chart js I am using at the moment is the 2.4.0, with angular chart version 1.1.1 (the current lastest one).
So, when I insert few series (for example 4) everything works fine. The problem is when I have cases that handle with 10 series at a time. The event of clicking the serie in order to hide it block somehow and this error is displayed in console:
Uncaught TypeError: Cannot read property 'clearRect' of null
at Object.helpers.clear (Chart.js:5880)
at Chart.Controller.clear (Chart.js:4072)
at Chart.Controller.draw (Chart.js:4365)
at ChartElement.animation.render (Chart.js:4345)
at Object.startDigest (Chart.js:3672)
at Chart.js:3645
To try to help you I moved to the line the error is occuring in Chart.js file:
// -- Canvas methods
helpers.clear = function(chart) {
chart.ctx.clearRect(0, 0, chart.width, chart.height);
};
Have anyone already got this problem? Does Chart js doesn't handle to many series?
Thanks

This was happening to me when I ran out of colors to use for my series. Once I fixed that the hiding and showing of series worked fine, plus no more errors.

Related

Angular & ag-grid: internal library issue with FiltersToolPanelModule

I get troubles while trying to put a simple SideBar with AG Grid with the latest versions of angular and ag-grid as of today (9.1.3 and 23.0.2).
My simple grid conf : sidebar = "filters"
Dependencies to necessary enterprises modules are present.
The panel is appearing but without any column name and I get the following error in console:
core.js:6210 ERROR TypeError: element.setAttribute is not a function
at Function.push../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js.Utils.addCssClass (ag-grid-community.cjs.js:1396)
Does anyone have an idea ? Some conflicts between dependencies ?

Adding and removing Measures dynamically in sapui5 VizFrame

I would like to change Measures dynamically in my VizFrame like in ChartDemo App from sapui5 docs [link below].
https://sapui5.netweaver.ondemand.com/test-resources/sap/viz/demokit/chartdemo/index.html
So when I click to one of my five checkboxes the proper Measure will be added or removed in case of unchecking.
I have one json from which I get data.
I've tried with this code:
if(oCheckBox.getSelected()){
oVizFrame.removeFeed(feedValuesAxis);
feedValuesAxis.setValues("ValueFromJSON");
oVizFrame.addFeed(feedValuesAxis);
}
But it causes error:
[50005] - valueAxis : does not meet the minimum or maximum number of
feeds definition.
I am using SAP UI5 version 1.28.
I have one VizFrame, one Dataset with all Measures and two FeedItem one for values and one for Dimension.
I guess I have to create a binding, right? But how should I do it? Thanks a lot for any pieces of advice.
Simply, I have missed array when putting value into setValues() method.
So the answer is:
feedValuesAxis.setValues(["ValueFromJSON"]);

Leaflet labels when upgrading to 1.0.3

I try to use leaflet labels and on several pages it is successful. I wanted to use the same approach to display labels on another page and it responded with an obscure technical message which I did not understand:
Uncaught TypeError: Cannot read property 'call' of undefined
at e.whenReady (leaflet.js:6)
at e.addLayer (leaflet.js:6)
at e.showLabel (leaflet.label-src.js:538)
at e.showLabel (leaflet.label-src.js:287)
at e._onMarkerAdd (leaflet.label-src.js:383)
at e.fire (leaflet.js:5)
at e._layerAdd (leaflet.js:6)
at e.whenReady (leaflet.js:6)
at e.addLayer (leaflet.js:6)
at e.onAdd (leaflet.js:7)
After a lot of researching I found out that leaflet.label is deprecated for Leaflet 1.0.3, which makes sense, since we are using older leaflet version in other pages where the labels appear correctly, but on the newer leaflet versions it crashes the map. The docs say that I should use bindTooltip instead of bindLabel, but I do not know how. I have tried to call it with some content on a marker but it did not appear on the map and I did not find it in the generated structure.
So, my question is as follows: How can I use labels with Leaflet 1.0.3, which will be bound to a marker and will adjust in case of translation/zoom?
The Tooltip is indeed now directly part of Leaflet main library.
Note that it appears only on mouseover by default, but you can use the permanent option to have it remain always visible.
marker.bindTooltip("Some tooltip content", {
permanent: true
});
Example: http://playground-leaflet.rhcloud.com/tiqo/1/edit?html,output

Google Annotation chart: Could it be possible to reverse the Y-axis?

I am working with the project that need Google Annotation Chart to show my data. And I have a problem like below.
My problem:
I would like to show the reverse value on the Y-axis.
What I mean is: the bigger the value is down and vice versa (the smaller the value is up)
I try to test all the option at the support docs but it still did not work
https://developers.google.com/chart/interactive/docs/gallery/annotationchart
Option:
...
vAxis: {direction: -1} // This works on line chart but not annotation chart
...
or somethings like
...
max: -200000, // this won't work and it's just keep the value not minus
min: 200000
...
This is my test code that forked from the docs page
https://jsfiddle.net/lecaoquochung/dsmgL9wj/2/
Could anyone help me to answer my problem? (Could it be possible to reverse the Y-axis now and later?)
Thank you very much
Problem solved. I have updated the testcode chart
Solution: add the chart to the option (get support from Googler)
chart : {vAxis: {direction: -1}},
Memo: Wonder that something updated in the API or just syntax (Because there is no description for chart option on graph docs pages)
Hope this help for anyone meet the same problem.

ZK Charts, clearing the chart

I am using ZK charts in my project. I am having line type charts. And using addSeries on my chats. But when I want refresh charts as in when user if fetching new Data, I am not sure how to clear the graph. Please help.
For example, if you are using series to add points on the chart (in my example I am using Float values) you can empty data displayed by setting an empty list to the series, like this:
chart.getSeries().setData(new ArrayList<Float>());
this one worked for me,
just write this line before populating your chart
chart.getSeries().setData(0);
To do that just call the method
chart.invalidate();