【转】Flash图表AnyChart应用教程四:如何改变轴标签属性

22 篇文章 0 订阅

有人问到如何自定义AnyChart 图表的轴标签属性,实际上,我们是无法自定义其属性的。但我们可以通过将轴标签换为其他标签的方式来改变其属性。

 

label_settings节点为例,用数据标签替换轴标签:

<label_settings enabled="true">
 <position anchor="XAxis" />
 <background enabled="false"/>
 <format>{%Name}({%phone})</format>
</label_settings>

 

要禁用原来的轴标签,将 enabled 设置为"false":

<x_axis enabled="true">
 <labels enabled="false"/>
</x_axis>

 

你也可以用extra 标签替换数据标签:

<extra_labels>
  <label enabled="true">
   <position anchor="Center" />
   <font color="White"/>
   <format>{%Value}</format>
  </label>
 </extra_labels>

 

以下是带有自定义属性"phone"的数据标签放在X轴上的代码示例:

<anychart>
<charts>
<chart plot_type="CategorizedHorizontal">
 <data_plot_settings default_series_type="Bar">
  <bar_series>
   <label_settings enabled="true">
   <position anchor="XAxis" />
   <background enabled="false"/>
   <format>{%Name}({%phone})</format>
  </label_settings>
 <extra_labels>
  <label enabled="true">
   <position anchor="Center" />
   <font color="White"/>
   <format>{%Value}</format>
  </label>
 </extra_labels>
</bar_series>
</data_plot_settings>
 <data>
  <series name="HQ">
  <attributes>
   <attribute name="location">LA</attribute>
  </attributes>
  <point name="John" y="17000">
   <attributes>
    <attribute name="phone">555-1267</attribute>
   </attributes>
  </point>
  <point name="Jake" y="19000">
   <attributes>
    <attribute name="phone">555-6790</attribute>
   </attributes>
  </point>
  <point name="Peter" y="18000">
   <attributes>
    <attribute name="phone">555-0112</attribute>
   </attributes>
  </point>
 </series>
</data>
<chart_settings>
 <title enabled="false"/>
  <axes>
   <y_axis enabled="true" position="Opposite">
    <scale minimum="0"/>
   </y_axis>
   <x_axis enabled="true">
    <labels enabled="false"/>
   </x_axis>
  </axes>
 </chart_settings>
</chart>
</charts>
</anychart>

 

 

 

本文转自:http://www.evget.com/zh-CN/info/catalog/18098.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值