16

All I'm trying to make charts using e charts library read the documentation and find lots of example over internet too but unable to find how to write label in y-axis with vertical text.

As per the docs where it might be write is axisLabel : {} object but still not sure.

Just want a simple text in vertical at y-axis

Rupesh Arora
  • 557
  • 2
  • 9
  • 26

1 Answers1

47

To insert the label on the y axis in vertical position, you should included the following suboptions in the yAxis option:

Code example:

    .......
    yAxis : [
      {
        type : 'value',
        axisLabel : {
          formatter: '{value} °C'
        },
        name: 'Y-Axis',
        nameLocation: 'middle',
        nameGap: 50
      }
    ],
    .......

where the nameLocation: 'middle' option will position the label vertically; And the nameGap: 50 option, indicates the separation with the axisLabel tags.

Attached a screenshot with the result

Nimantha
  • 6,405
  • 6
  • 28
  • 69
E. Lion
  • 628
  • 6
  • 9
  • Thanks for your help it worked for me. Can you please let me know where in the documentation it was written. I'll appreciate you for this effort too. – Rupesh Arora May 12 '17 at 02:54
  • 2
    There are configuration options in the sample gallery, which do not come in the echarts API. I passed the link. I'm glad I helped you. (http://gallery.echartsjs.com/explore.html#sort=rank~timeframe=all~author=all). This last link is from an example graph with the y-Axis axis label vertically (http://gallery.echartsjs.com/editor.html?c=xHkBm-zFYg) – E. Lion May 12 '17 at 06:23
  • The only thing is that `nameLocation = 'middle'` only works in echarts version 3. Version 2 only suports `start | end`. – Anjan Biswas May 12 '17 at 23:12