`
FengShen_Xia
  • 浏览: 272661 次
  • 性别: Icon_minigender_1
  • 来自: 东方水城
社区版块
存档分类
最新评论

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

 
阅读更多

有人问到如何自定义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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics