25/10/2023 | 6000 |
31/10/2023 | 0 |
6/11/2023 | 2500 |
6/11/2023 | 500 |
12/11/2023 | -7800 |
16/11/2023 | 500 |
i have a table and i'm trying to create a line chart that starts at 6000, then has a straight line until it hits the date 6/11/2023 at which point it adds a line 90 degrees and goes up to 8500 and so on .. going up at 90 degrees and down at 90 degrees for the negative values keeping the current total
thanks,
I think you are looking for a stepped line graph?
You could do something like this (I changed the second instance of 6/11 to 7/11 to show the changes separately, I also added another 12/11 to show the impact of having two values for the same date where one is negative and the other positive.)
| makeresults format=csv data="date,change
25/10/2023,6000
31/10/2023,0
6/11/2023,2500
7/11/2023,500
12/11/2023,-7800
12/11/2023,800
16/11/2023,500"
| eval _time=strptime(date,"%d/%m/%Y")
| streamstats sum(change) as total
| autoregress total
| eval row=mvrange(0,2)
| mvexpand row
| eval total=if(row=0,total_p1,total)
| table _time total
Note that this chart only works well with _time for the x-axis, other scales not so well.