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!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...