Somnath Muluk Somnath Muluk - 4 months ago 17
Javascript Question

How to make google scatter chart divided as Quadrants with positive values?

If there are positive and negative values then it make quadrant by dividing at zero. You can see at this plunker example.

But how to make quadrants when there are only positive values? See this positive values plunker

chart2.options = {
"title": "Age Vs Weight",
"hAxis": {
"title": "Age",
minValue: 0,
maxValue: 3,
ticks: [0, 1.0, 2.0, 3.0],
viewWindow: {
min: 0,
max: 3.0
}
},
"vAxis": {
"title": "Weight",
minValue: 0,
maxValue: 3,
ticks: [0, 1.0, 2.0, 3.0],
viewWindow: {
min: 0,
max: 3.0
}
},
"legend": 'none'
};


It should show quadrants by calculating median of positive values. Quadrant graph is useful for analyzing 2 dimensions which is too good or too bad.

Is it possible to divide axis in middle which should be dark colored and other ticks should be faint?

Answer

There is no auto option for making quadrant. There is one property baseline for hAxis and vAxis by which we can make axis baseline position.

vAxis.baseline : <point>
hAxis.baseline : <point>

See options suggested.

chart2.options = {
"title": "Age Vs Weight",
"hAxis": {
  "title": "Age",
  minValue: 0,
  maxValue: 3,
  baseline: 1.5,
  ticks: [0, 1.0, 2.0, 3.0],
  viewWindow: {
    min: 0,
    max: 3.0
  }
},
"vAxis": {
  "title": "Weight",
  minValue: 0,
  maxValue: 3,
  baseline: 1.5,
  ticks: [0, 1.0, 2.0, 3.0],
  viewWindow: {
    min: 0,
    max: 3.0
  }
},
"legend": 'none'
};
Comments