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
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...