Raviteja
Raviteja

Reputation: 96

can use strings as X axis labels in jsx graph

I am trying to draw a graph exactly like this using JSX graph library: enter image description here

but i stucked at changing x axis variables to texts..

Thanks in Advance..

Upvotes: 1

Views: 241

Answers (1)

Alfred Wassermann
Alfred Wassermann

Reputation: 2323

For the time being, this is not possible out of the box. There are two easy possibilities: Either you place the labels above the bars. This can be done by using the labels attribute:

var a = board.create('chart', dataArr, {
    chartStyle: 'bar',
    width: 0.6,
    labels: ['cat', 'dog', 'mouse'],
    hasInnerPoints: true,
    label: {
        fontSize: 16
    }
});

The other option is to but text elements "by hand" below the axis:

board.create('text', [1, -0.5,  'cat'], {});
board.create('text', [2, -0.5,  'dog'], {});
board.create('text', [3, -0.5,  'mouse'], {});

Upvotes: 2

Related Questions