Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valueAxes is not working for X axis #85

Open
Khaledneo opened this issue Nov 27, 2018 · 1 comment
Open

valueAxes is not working for X axis #85

Khaledneo opened this issue Nov 27, 2018 · 1 comment

Comments

@Khaledneo
Copy link

Khaledneo commented Nov 27, 2018

Hello,

I'm using the following Amchart config:

{
  "type": "serial",
  "theme": "light",
  "autoMarginOffset": 20,
  "graphs": [{
    "id": "g1",
    "balloonText": "[[value]]",
    "bullet": "diamond",
    "bulletBorderAlpha": 1,
    "bulletColor": "#FFFFFF",
    "hideBulletsCount": 50,
    "title": "red line",
    "valueField": "ay",
    "lineAlpha": 0.8,
    "lineThickness": 2,
    "lineColor": "#b0de09",
    "fillAlphas": 0,
	"useLineColorForBulletBorder": true
  }, {
    "id": "g2",
    "balloonText": "[[value]]",
    "bullet": "round",
    "bulletBorderAlpha": 1,
    "bulletColor": "#FFFFFF",
    "hideBulletsCount": 50,
    "title": "red line",
    "valueField": "by",
    "lineAlpha": 0.8,
    "lineThickness": 2,
    "lineColor": "#fcd202",
    "fillAlphas": 0,
	"useLineColorForBulletBorder": true
  }],
  "chartCursor": {
    "limitToGraph": "g1"
  },
  "categoryField": "date",
  "categoryAxis": {
    "parseDates": true,
    "axisColor": "#DADADA",
    "dashLength": 1,
    "minorGridEnabled": true
  },
  "valueAxes": [{
    "axisAlpha": 0,
     title: "Y",
    "position": "right",
  },{
    "axisAlpha": 1,
    "title": "X",
    "position": "bottom",
  }],
}

valueAxes object is applied only for Y axis by adding the title and changed the opacity.

Why is not applied for the X axis one?

Thanks.

@xorspark
Copy link

Serial charts can only have one horizontal/X axis (or Y if rotate: true is set), and that axis must be a category axis, which isn't fully numeric. You can set the second value axis as a second Y axis (position: "left" or position: "right"), but you also need to specify IDs and assign your graphs to them, e.g.

graphs: [{
  // ...
  "valueAxis": "v1, //use right hand axis
}, {
  // ...
  valueAxis: "v2" //use left hand axis
}],
// ...
valueAxes: [{
  "position": "right",
  "id": "v1",
  // ...
}, {
  "position": "left",
  "id": "v2"
}]

If you need both a numeric X and Y axis, consider using an XY chart instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants