The actual problem lies in the JS script tag region instantiated just
before the closing body tag. When the Zoom OUT feature doesn't show
up in the plot, there is an AJAX call to the Splunk REST API that fails
in the browser debugger console. That REST API call is to the SVG(scalar
vector graphic) library routine that lets you pan/zoom the SVG
rendering, and there isn't a need to recall the search manager to do it.
That's why it's so fast. No search manager job latency. Just rendering
of the partial DOM associated with the chart.
But who is to blame is still what I don't know yet.
The players in this dilemma are the following:
jQuery
RequireJS
XMLHTTPREQUEST(Async AJAX GET)
SPLUNK REST API
SVG library routine used by the SPLUNK server
Note: The failure shown in the debugger console ONLY says that
it can't reach the SPLUNK server through it's REST API,
via the AJAX call. But occasionally, it CAN. 😞
<script style="text/javascript">
requirejs(['jquery', 'svg-pan-zoom'], function(jquery, svgPanZoom) {
$(document).ready(function () {
$.ajax({
type: 'GET',
url: "/api/v2/graph/2243/svg/",
success: function (obj) {
$("#svg").html(obj.data);
var panZoom = svgPanZoom('#svg svg', {
minZoom: 0.1,
zoomEnabled: true,
controlIconsEnabled: true,
fit: true,
center: true
});
// Get the container sized correctly
$("#svg").css({
width: "100%", height: $("#svg svg").height() + 40,
'max-height': '600px'
});
// Now set the svg to use 100%
$("#svg svg").css({width: "100%", height: "100%", 'max-height': '100%'});
// Get the menu in the right spot
panZoom.resize();
// On any move readjust it.
$(window).resize(function () {
panZoom.resize();
panZoom.fit(true);
panZoom.center(true);
})
}
});
});
});
</script>
... View more