Note that there are some explanatory texts on larger screens.

plurals
  1. POHighcharts add&remove data to series in stacked-column chart
    primarykey
    data
    text
    <p>I am trying to edit stacked-column chart by adding/removing data and categories from highcharts stacked/column chart. But there are inconsistencies on chart as category names/value/count.</p> <p>My add function /param:data/:</p> <pre><code> //setting category names var categories = this.obj.xAxis[0].categories; categories.push(data.name); this.obj.xAxis[0].setCategories(categories); //adding new points getting the series by name this.obj.get("a").addPoint(data); this.obj.redraw(); </code></pre> <p>My remove function/param:name/:</p> <pre><code> var self = this; var cat; var data_series = []; $.each(self.obj.series, function(sKey, sVal){ var j = sVal.data.length - 1; var isRemoved = false; var dt; while(!isRemoved &amp;&amp; j &gt;= 0) { var dVal = sVal.data[j]; if (dVal.category === name) { dVal.remove(); isRemoved = true; } j--; } }); var categories = self.obj.xAxis[0].categories; categories.splice( $.inArray(name, categories), 1 ); self.obj.xAxis[0].setCategories(categories); self.obj.redraw(); </code></pre> <p>The result is like this: I can add new categories/points, stacks and columns properly. I can remove the latest categories properly, it shifts to left and they are rendered fine. But when I remove category A from the categories [A,B,C,D] the result is rendered as [C,D,3]. However, it should be [B,C,D]. And whenever I add any new category after this it increases the last number instead of the string I give.</p> <p>I am wondering what would be wrong the code above and what the proper way to add/remove categories,points,data to/from stacked column chart is.</p> <p>Here you can try it out: <a href="http://jsfiddle.net/gencay/UP55k/" rel="nofollow">http://jsfiddle.net/gencay/UP55k/</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload