echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Show days on Xaxis that are not in the dataset

Open erikgalajda opened this issue 2 years ago • 10 comments

What problem does this feature solve?

I would like to be able to show all days on the xAxis, even these that do not have an entry in the data. Is that already possible via an option or do I need to add them manually into the data array with 0 value?

What does the proposed API look like?

An option for showing all days on the xAxis

erikgalajda avatar Jan 09 '24 10:01 erikgalajda

An example would be helpful to clear up any uncertainty about your use case.

As it is I would suggest taking a look at interval or minInterval / maxInterval

MatthiasMert avatar Jan 09 '24 12:01 MatthiasMert

['01-01-2024', '03-01-2024', '05-01-2024'] -> dataList for xAxis, I will see only these specific dates, is there a way to show the other dates like '02-01-2024' on the xAxis without adding them manually to the dataList?

erikgalajda avatar Jan 09 '24 13:01 erikgalajda

Still not a very elaborate example. But from that I am now guessing that you are using axis type 'category'. Here is an example using axis type 'time'.

MatthiasMert avatar Jan 09 '24 13:01 MatthiasMert

image

basically my idea was to have a point for days which are not in the data and to assign them value 0 but I guess that's not possible unless I manually create entries with 0 value in the data array

erikgalajda avatar Jan 09 '24 13:01 erikgalajda

I dont understand why the solution I provided is not applicable. You can also use the label formatter function to bring the dates into a format of your choice: Example

MatthiasMert avatar Jan 09 '24 14:01 MatthiasMert

In your solution, only dates that are in const data are displayed, ['01-01-2024', '03-01-2024', '05-01-2024']

I would like to show all the missing dates from 01-01-2024 to 05-01-2024 like 02-01 or 04-01 with value '0'. So I was wondering whether there's an option to do that but it doesn't look like there is.

erikgalajda avatar Jan 09 '24 15:01 erikgalajda

an option to do that but it doesn't look like there is.

Correct, ECharts, like any other charting software, does not create data points, just displays them.

NB: 📌 please close issue if problem solved.

helgasoft avatar Jan 09 '24 17:01 helgasoft

same issue I met, when I use duration days as a data value, it seems hard to set every day as label.

Alia2006 avatar Jan 12 '24 01:01 Alia2006

I am in bar type

Alia2006 avatar Jan 12 '24 01:01 Alia2006

Seems like Echarts, in line mode, is not able to understand a missing time point, it just connects the line.

 const data = [ { name: '2024-04-13', value: ['2024-04-13', '100'] }, { name: '2024-04-15', value: ['2024-04-15', '400'] }, { name: '2024-04-17', value: ['2024-04-17', '500'] }, { name: '2024-04-18', value: ['2024-04-18', '600'] }, ];

line type a8a201b3-f2be-4c33-8d6e-4a4b89867391

The ‘bar’ type . image

If I display the graph with a line, it would be nice to be able to choose whether or not to connect/disconnect the line.

It would be very nice to solve this similar to how Grafana solves this problem: https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/time-series/#disconnect-values (using never or with a Threshold )

pasch82-code avatar Dec 10 '24 15:12 pasch82-code