echarts icon indicating copy to clipboard operation
echarts copied to clipboard

echarts option nameRotate not working

Open LMJS1974 opened this issue 9 years ago • 4 comments

One-line summary [问题简述]

I am trying to rotate the labels on the xAxis so they are all visible.

Looking at the documentation i see there is an option to use the command nameRotate but it doesn't seem to work..?

tried to apply the syntax to the online demo and not working either....

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.6.2
  • Browser version [浏览器类型和版本]: edge, chrome
  • OS Version [操作系统类型和版本]: windows 10

Expected behaviour [期望结果]

labels in the bottom of chart (xAxis) rotating to vertical

ECharts option [ECharts配置项]

			  var echartBar = echarts.init(document.getElementById('mainb'), theme);

			  echartBar.setOption({
				title: {
				 //text: 'Graph title',
				 //subtext: 'Graph Sub-text'
				},
				tooltip: {
				  trigger: 'axis',
				  formatter: "{a} <br/>{b} : {c}%"

				},
				legend: {
				 // data: ['sales', 'purchases']
				},
				toolbox: {
				  show: false
				},
				calculable: true,
				xAxis: {
				  nameRotate: 90, //Rotation of labels - not working!!!!
				  type: 'category',
				  data: ['Client 1', 'Client2', 'Client3', 'Client4', 'Client5', 'Client6', 'Client7', 'Client8', 'Client9?', 'Client10', 'Client11', 'Client12'] //Clients go here
				},
				yAxis: [{
				  type: 'value'
				}],
				series: [{
				  name: 'Overall Progress',
				  type: 'bar',
				  data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
				  markPoint: {
					data: [{
					  type: 'max',
					  name: 'MAxim',
					  					  formatter: "{a} <br/>{b} : {c}%"

					}, {
					  type: 'min',
					  name: '???'
					}]
				  },
				  markLine: {
					data: [{
					  type: 'average',
					  name: 'Average'
					}]
				  }
option = {

}

Other comments [其他信息]

LMJS1974 avatar Aug 08 '17 18:08 LMJS1974

xAxis.nameRotate is just used to set the xAxis name's rotate(usually display at the left or right of the axis) . You can set the xAxis.axisLabel.interval or xAxis.axisLabel.rotate to show all the axisLabel.

luguokong avatar Aug 09 '17 02:08 luguokong

Thank you for clarifying. Clearly I was looking in the wrong place. Working now. Great package! Keep up the good work. :)

LMJS1974 avatar Aug 09 '17 10:08 LMJS1974

Does someone know how to get another not rotated line under the rotated line like this grafik

elizarrrrr avatar Sep 22 '20 14:09 elizarrrrr

@elipongr, define the "rotate" option inside axisLabel:

    graph_options = {
        youroptions: youroptions...,
        xAxis: [{
            youraxisoptions: youraxisoptions...,
            axisLabel: {
              rotate: 45, // <<<<<<<<<<<<<< this option!
            }
        }],
    };

alexlana avatar Dec 09 '20 20:12 alexlana