Dashboards & Visualizations

Creating a line graph with positive and negative values in line graph at right angles (not connecting at angles)

Esky73
Builder
25/10/20236000
31/10/20230
6/11/20232500
6/11/2023500
12/11/2023-7800
16/11/2023500

 

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,

Labels (2)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

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

ITWhisperer_0-1700645791928.png

Note that this chart only works well with _time for the x-axis, other scales not so well.

 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...