Change the type of the X axis from category to date and time when sweeping

Is it possible to change the axis type of the x-axis from a category in datetime when sweeping? I have a column graph column, where each column is a different category. When I click on one of the columns, I want to expand it to the selected column of this category with the x axis of datetime.

I managed to successfully expand the style chart of another category and set each category per day to daterange, but using the datetime format would be much better.

Here is the "onClick" code that I run to try to do this. Obviously, data is exemplary data to make things simple. This currently causes Firefox to crash with a memory limit.

Is it possible to dynamically switch to the x axis in this way?

function setChart() { while(hChart.series.length > 0){ hChart.series[0].remove(); } hChart.xAxis[0].update({ type: 'datetime' }); console.log(hChart.xAxis[0]); data = [ [Date.UTC(2010, 0, 1), 5], [Date.UTC(2010, 0, 2), 11], [Date.UTC(2010, 0, 3), 3], [Date.UTC(2010, 0, 6), 7], [Date.UTC(2010, 0, 7), 4], [Date.UTC(2010, 0, 8), 1] ]; console.log(data); hChart.addSeries({ type: 'column', data: data, }, false); hChart.redraw(); } 
+2
source share
2 answers

Unfortunately, this parameter is not avaialble, you need to destroy and create a new diagram.

+1
source

For someone still looking for an answer. Decision:

Define the X axis in the array :

 xAxis: [{ id: 0, type: 'category' }, { id: 1, type: 'datetime' }] 

For each series in the scan

 drilldown: { series: [{ name: "test", id: "test", xAxis: 1, // <--- your desired X axis ID data: [ [your data] ] }] } 
+5
source

Source: https://habr.com/ru/post/1495816/


All Articles