Dashboards & Visualizations

Not able to draw bar chart

uppukumar
Explorer

Hi All,

<|script python afiStatistics afiStats >
Above query Result is following output:

Type Count
Allowed 11
Blocked 12

With the above query i want create Bar chart, But it is not able to draw the chart

Expected output
|
Type|--------------------------------------------
|--------------------------
|
Count

advance Thanks,

0 Karma

woodcock
Esteemed Legend

Just add | table Type Count to change the order of the fields; here is a run-anywhere example:

| makeresults 
| eval raw="Type=Allowed,Count=11 Type=Blocked,Count=12" 
| makemv raw 
| mvexpand raw 
| rename raw As _raw 
| kv
| fields - _*
| table Type Count
0 Karma

rbechtold
Communicator

Hey Uppukumar!

Let me know if this works for you:

...BASE SEARCH...
| table Type Count 
| chart values(Count) AS Count by Type 
| sort - Count

Make sure the "Bar Chart" is selected as your visualization type, and your data should display the way you described.

Since the count is already aggregated in your data, the values function should work for you.

If you would prefer aggregate your data or chart it in a different way, refer to the "Stats function options" section of the Splunk chart documentation.

https://docs.splunk.com/Documentation/Splunk/7.3.0/SearchReference/Chart

Let me know if you have any problems!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...