zoukankan      html  css  js  c++  java
  • flex 图表categoryField设置 labelFunction使用

    CategoryAxis有一个叫做labelFunction的属性,这个属性的定义:指定一个函数,用于定义为CategoryAxis的dataProvider中的各个项目生成的标签。

    所以修改的原理:可以利用labelFunction得到每个Label,然后再对其进行修改。

    片段代码:
    <mx:horizontalAxis>
      <mx:CategoryAxis id="ca"
             categoryField="@date" title="August 2007" labelFunction="categoryAxisLabelFun" />
    </mx:horizontalAxis>
     
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return temp;
    }

    其中categoryAxisLabelFun的参数:
    1、item:保存的就是Label里面文字信息。
    2、prevValue:坐标轴上面,前一个类别的值。
    3、axis:CategoryAxis的实例化对象。
    4、categoryItem:是将要呈现的dataProvider中的项目。
    所以与标签有关系的只有第一个参数:item。
     
    以下代码分别是对CategoryAxis的标签进行修改的代码:
     
    1、改变字体大小:
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return  '<font size="20">' + temp + </font>';
    }

    2、改变字体粗细:
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return  '<B>' + temp + </B>';
    }

    3、改变字体下划线:
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return  '<U>' + temp + </U>';
    }

    4、改变字体斜体:
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return  '<I>' + temp + </I>';
    }

    5、改变字体颜色:
    private function categoryAxisLabelFun( item : Object, prevValue : Object, axis : CategoryAxis, categoryItem : Object) : String {
          var temp : String = item as String;
          return  '<font color="#ff0000">' + temp + </font>';
    }

  • 相关阅读:
    python中selenium+unittest实操
    python+selenium元素定位04——浏览器多窗口处理
    python+selenium元素定位03——自动化常见场景处理
    python+selenium元素定位02——层级定位
    requests.post() 方法的使用
    python+selenium元素定位01——显式、隐式等待
    python+selenium之元素识别二
    IO流常用基类
    STS中导入Jmeter源码遇到的坑
    MySql处理日期时间常用函数
  • 原文地址:https://www.cnblogs.com/secbook/p/2655202.html
Copyright © 2011-2022 走看看