Snippets

Piotr Szrajber Smart M.App - Fix axis padding in the time chart

Created by Piotr Szrajber last modified
/**
 * Fix axis padding in the time chart
 * 2016-10-12 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>
 */
var TIME_CHART_NAME = "Rainfall by time"; // change it to the name of your time chart

function fixAxisPadding() {
    $GP.bi.stage.findWidgets({
        descriptors: [{
            chartM: {
                name: TIME_CHART_NAME
            }
        }]
    }, function(widgets) {
        if (!widgets || !widgets[0]) {
            setTimeout(fixAxisPadding, 300);
            return;
        }
        widgets[0].chart.redrawChart({
            axis: {
                x: {
                    padding: "10%"
                }
            }
        })
    });
}


//$GP.ready("v1.0", function($GP) { // uncomment if using in the browser javascript console
fixAxisPadding();
//}); // uncomment if using in the browser javascript console

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.