Dashboards & Visualizations

Line chart annotation is not working with non-time based x-axis in Dashboard Studio

yoongchean
Observer

I try to plot a line graph where the x-axis is an index  and y-axis is a random value. I also trying to add an annotation where the annotationX is an index. Below is the code for the visualization.

 

 

"visualizations": {
		"viz_kHEXe45c": {
			"type": "splunk.area",
			"dataSources": {
				"primary": "ds_Search_1",
				"annotation": "ds_annotation_markers"
			},
			"options": {
				"x": "> primary | seriesByIndex(0)",
				"annotationX": "> annotation | seriesByIndex(0)",
				"annotationLabel": "> annotation | seriesByIndex(1)",
				"annotationColor": "> annotation | seriesByIndex(2)",
				"nullValueDisplay": "zero"
			},
			"title": "Test Event Annotation",
			"showProgressBar": false,
			"showLastUpdated": false
		}
	},
	"dataSources": {
		"ds_Search_1": {
			"type": "ds.search",
			"options": {
				"query": "| makeresults count=15\n| streamstats count\n| eval index=count\n| eval value=random()%100\n| fields index value"
			},
			"name": "ds_Search_1"
		},
		"ds_annotation_markers": {
			"type": "ds.search",
			"options": {
				"query": "| makeresults count=3\n| streamstats count\n| eval index=count\n| eval score = random()%3 +1\n| eval status = case(score=1,\"server error detected\", score=2, \"unknown user access\", score=3, \"status cleared\")\n| eval color = case(score=1,\"#f44271\", score=2, \"#f4a941\", score=3, \"#41f49a\")\n| table index status color"
			},
			"name": "ds_annotation_markers"
		}
	},

 

 

 

Below is the line graph output shown based on the code above.

yoongchean_0-1715141398222.png

 

Could anyone please help how to add the annotation on the line graph when the x-axis is a non-time based number type?

 

Labels (2)
Tags (2)
0 Karma

KendallW
Contributor

Hi @yoongchean It might be because makeresults generates the _time field, which Splunk automatically puts on the x axis when no chart options are specified. Try simply removing the _time field with 

| fields - _time



0 Karma

yoongchean
Observer

Hi @KendallW , I have add the fields - _time at the last SPL command to remove the _time field. Unfortunately, it still doesn't show the annotation in the line graph.  

0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...