Dashboards & Visualizations

How do I render a chart with an overlay using the "View as Axis" option using the splunk-sdk for javascript?

jmacgowan
New Member

I'm trying to render a chart with an "View as Axis" overlay using the javascript splunk-sdk. Setting the following options does not achieve the expected result:

window.splunkjs.UI.ready(window.chartToken, function () {
  chart.setData(results, {
    ...
    "axisY2.enabled": true,
    "axisY2.scale": "inherit",
    "chart.overlayFields": "some-field-name"
  });
  chart.draw();
});

I also tried setting chart.overlayFields as an array "chart.overlayFields": ["some-field-name"]

What am I missing to make this happen? I have all the options set as shown by looking at a chart definition XML in splunk itself.

0 Karma

sklass
Path Finder

Using the Javascript SDK here is how I do this. charting. seems to be missing

var saved_search_108 = new SavedSearchManager({
      id: 'saved_search_108',
      searchname: saved_search_lookup[get_object(object_id)]['search_108'][get_corrected_time(earliest_time_id)],
      cache: true,
      preview: true,
      earliest_time: get_corrected_time(earliest_time_id),
      latest_time:  get_corrected_time(latest_time_id),
      app: 'envision',
});

var chart_108 = new ChartView({
      id: 'chart_108',
      type: 'column',
      el:  $('#chart_108'),
      "charting.axisY2.enabled": true,
      "charting.chart.columnAlignment": .5,
      "charting.chart.overlayFields": "Total",
      "charting.legend.placement": "bottom",
      managerid: 'saved_search_108',
}).render();
0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...