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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...