javascript - 图表类别标签只会从中心旋转?

标签 javascript extjs

我刚刚开始学习 EXT JS,我尝试梳理教程,但似乎对我的问题没有找到太多运气。我的问题是我有一个条形图,我想旋转标签以留出更多空间。我可以很好地旋转它们,但旋转点似乎基于标签的中间。我希望标签的末尾与该特定列的标记对齐。

如果这没有意义的话,这是一张图片:

我有什么:

enter image description here

我想要什么:

What I want

看来我想要实现的是一个非常标准的事情,但我似乎找不到太多关于这个问题的信息。

代码片段:

{
  xtype        : 'cartesian',
  store        : 'Store1',
  height       : 350,
  width        : 390,
  flipXY       : true,
  axes         : [
      {
         type     : 'category',
         position : 'left',
         label    : {
             rotation : {
                 degrees : -15
             }    
         }
    },
    {
       type     : 'numeric',
       position : 'bottom'
      }
    ],
    series : [
       {
          type    : 'bar',
          xField  : 'cName',
          yField  : 'cNumber',
          colors  : ['#99CCFF'],
          label   : {
              display : 'outside',
              field   : 'cNumber'
          }
      }
  ]
}

最佳答案

您可以设置textAlign: 'end',将label配置更改为:

label: {
    textAlign: 'end',
    rotation: {
        degrees: -15
    }
}
<小时/>

编辑

尝试过标签配置后,希望这就是您所寻找的:

label: {
    textAlign: 'end',
    textBaseline: 'hanging',
    x: -10,
    y: -10,
    rotation: {
        degrees: -15,
        centerX: -5
    }
}

工作示例:https://fiddle.sencha.com/#fiddle/uea

关于javascript - 图表类别标签只会从中心旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32748842/

相关文章:

javascript - ExtJS 6.x (6.5.2) 现代自定义组件

javascript - js2xmlparser 自定义 XML 正文

javascript - 使用 Flowplayer 自动重复或如何在 javascript 中将回调作为字符串传递

javascript - 替换jquery中 anchor 标签的值

css - 如何在 ext.js 面板中自动调整行高和宽度?

javascript - 如何使用 Ext-JS 中的默认值填充 ItemSeclector 中的选定列

extjs - 在 ExtJS 组件中如何转发配置 : {} items to sub components

javascript - 谷歌加一键不起作用(谷歌加一键错误)

javascript - 在 Chrome 中使用 JSONP 加载推特数据

javascript - 将单个对象加载到 sencha touch 中的数据存储中