Search code examples
jsxgraph

How to add small amount of space between bars in bargraph using JSXGraph


The bars are too close to each other, I need small seperation between them so that it can correspond to the spaces occupied by xaxis labels


Solution

  • The only possibility to control the distance between the bars is to supply the chart with the attribute "width" and set the bounding box of the board:

    var board = JXG.JSXGraph.initBoard('jxgbox', {
        boundingbox: [-1, 10, 20, -2], keepAspectRatio: false,
        axis: true
        }),
    var dataArr = [4,1,3,2,5,6.5,1.5,2,0.5,1.5,-1];            
    var chart = board.createElement('chart', dataArr, {chartStyle:'bar', width:0.7});