Search code examples
javascriptdojochartsdojox.charting

change the color of grid plot -dojo


i am using this code:

chart1.addPlot("grid", {
type: "Grid", 
hMinorLines: true
});

how i can change the color of the grid, and the interval between each line ? It is possible, right?

thanks

enter image description here


Solution

  • The Grid's intervals between lines are determined by the tick step parameters you give to the axis. So if you want major horizontal lines/ticks for every integer, and minor horizontal lines for every .25, you can do:

    chart1.addAxis("y", {
        ...
        majorTickStep: 1, 
        minorTickStep: 0.25
    });
    

    To change the color of the grid lines, the only way I know of is to manipulate the theme you are using.

    var myTheme = dojox.charting.themes.PlotKit.blue; // Or any other theme
    
    myTheme.axis.majorTick.color = "green";
    myTheme.axis.minorTick.color = "red";
    
    chart1.setTheme(myTheme);