Dashboards & Visualizations

How do I set the legend placement for a chart in an HTML dashboard?

unclethan
Path Finder

According to http://docs.splunk.com/Documentation/WebFramework, "Charts support the same properties supported by the Splunk JSChart library", however I am unable to find the correct incantation to set 'charting.legend.placement' to 'bottom'.

Does anyone have an example of how to set this up?

1 Solution

Simon_Fishel
Splunk Employee
Splunk Employee

I think you can just pass it as an option to the chart constructor:

var ChartView = require("splunkjs/mvc/chartview");
new ChartView({
    id: "example-chart",
    managerid: "example-search",
    type: "line",
    el: $("#mychart"),
    "charting.legend.placement": "bottom"
}).render();

Or set it after the chart has been created:

splunkjs.mvc.Components.getInstance("example-chart").settings.set({
    "charting.legend.placement": "bottom",
});

View solution in original post

Simon_Fishel
Splunk Employee
Splunk Employee

I think you can just pass it as an option to the chart constructor:

var ChartView = require("splunkjs/mvc/chartview");
new ChartView({
    id: "example-chart",
    managerid: "example-search",
    type: "line",
    el: $("#mychart"),
    "charting.legend.placement": "bottom"
}).render();

Or set it after the chart has been created:

splunkjs.mvc.Components.getInstance("example-chart").settings.set({
    "charting.legend.placement": "bottom",
});

bhawkins1
Communicator

Here you can find the possible values for charting.legend.*: http://docs.splunk.com/Documentation/Splunk/5.0/Viz/CustomChartingConfig-ChartLegend#Legend

0 Karma

unclethan
Path Finder

This worked - Thanks.
I had been hoping to have a django-bindings option, so that all the options were in one place.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...