I am creating a Javascript app outside of Splunk, and trying to dynamically reset the number of points that get charted in a ChartView instance.
I have tried doing this in two different ways, but none of the two options produces a re-render, as expected:
1-
mychart.settings.set("charting.data.count", <value>);
mychart.render();
2-
mychart.settings.set({ "charting.data.count": <value> });
mychart.render();
(NOTE: the suggestion that it be " mychart.settings.set({"charting.data.count", <value>}); " is actually syntactically incorrect, and Javascript complaints about it immediately)
My event handler (attached to a dropdown view) is as follows:
myDropDownView.on("change", function() {
const numElement = parseInt( myDropDownView.val());
console.log("Trying to set bar chart to display " + numElement + " data points...");
mychart.settings.set("charting.data.count", numElement); // using alternative 1 and also 2
mychart.render();
});
NOTES:
1- I have also tried the above without converting the value retrieved from the drop down to a number (in other words, tried with a string and a number).
2- The event handler executes, since it logs as expected
Am I missing something, or this setting somehow differs from all the others and cannot be dynamically updated?
Further update on 3/3/20: I notice that the chart actually re-renders, but it completely ignores the changed setting (that is, it renders as it originally did before I updated the setting.) I am starting to believe this may be a Splunkjs bug... Could somebody from Splunk confirm?
... View more