PrestonDocks
PrestonDocks

Reputation: 5408

High Charts stack column from json object

I am using KnexJS to get data from MySQL for use in a HighCharts stacked column chart.

My data db result looks something like

[
{
week: 201816,
name: 'apples',
qty: 6
},
{
week: 201816,
name: 'pears',
qty: 4
},
{
week: 201815,
name: 'apples',
qty: 5
}
]

This is extremely simplistic, in reality there are thousands of results.

The problem here as you can see is that Week 201815 does not have category pears, so to use this data, I will have to loop over every week and within that loop, loop over every category looking for missing categories and setting them to zero. In some cases this ends up with 100,000's of itterations in my loop.

Does High Charts support any way of just throwing my data structure at it and having it fill in missing categories automagically?

Upvotes: 0

Views: 49

Answers (1)

Kamil Kulig
Kamil Kulig

Reputation: 5826

Highcharts is a library that servers only to visualize the data - not to process it. There's no mechanism that'll fill in missing categories automatically.

Upvotes: 1

Related Questions