`
xiaoer_1982
  • 浏览: 1882192 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Creating a custom label function on a Flex LineChart control’s category axis

阅读更多

www.diy567.com是我弄的文娱网站,累了,去上面休息一下下

The following example shows how you can create a custom label function on a CategoryAxis in a Flex LineChart control.

For an example of creating a custom label function for the vertical/linear axis, check out “Creating a custom label function on a Flex LineChart control’s linear axis”.

Full code after the jump.

View MXML

<?xml version="1.0"?>
<!-- http://blog.flexexamples.com/2007/11/16/creating-a-custom-label-function-on-a-flex-linechart-controls-category-axis/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            private function categoryAxis_labelFunc(item:Object, prevValue:Object, axis:CategoryAxis, categoryItem:Object):String {
                var datNum:Number = Date.parse(item);
                var tempDate:Date = new Date(datNum);
                return dateFormatter.format(tempDate).toUpperCase();
            }
        ]]>
    </mx:Script>

    <mx:DateFormatter id="dateFormatter" formatString="MMMM-DD-YYYY" />

    <mx:XMLListCollection id="dp">
        <mx:source>
            <mx:XMLList>
                <quote date="8/1/2007" open="40.29" close="39.58" />
                <quote date="8/2/2007" open="39.4" close="39.52" />
                <quote date="8/3/2007" open="39.47" close="38.75" />
                <quote date="8/6/2007" open="38.71" close="39.38" />
                <quote date="8/7/2007" open="39.08" close="39.42" />
                <quote date="8/8/2007" open="39.61" close="40.23" />
                <quote date="8/9/2007" open="39.9" close="40.75" />
                <quote date="8/10/2007" open="41.3" close="41.06" />
                <quote date="8/13/2007" open="41" close="40.83" />
                <quote date="8/14/2007" open="41.01" close="40.41" />
                <quote date="8/15/2007" open="40.22" close="40.18" />
                <quote date="8/16/2007" open="39.83" close="39.96" />
                <quote date="8/17/2007" open="40.18" close="40.32" />
                <quote date="8/20/2007" open="40.55" close="40.74" />
                <quote date="8/21/2007" open="40.41" close="40.13" />
                <quote date="8/22/2007" open="40.4" close="40.77" />
                <quote date="8/23/2007" open="40.82" close="40.6" />
                <quote date="8/24/2007" open="40.5" close="40.41" />
                <quote date="8/27/2007" open="40.38" close="40.81" />
            </mx:XMLList>
        </mx:source>
    </mx:XMLListCollection>

    <mx:LineChart id="lineChart"
            showDataTips="true"
            dataProvider="{dp}"
            width="100%"
            height="100%">

        <!-- vertical axis -->
        <mx:verticalAxis>
            <mx:LinearAxis baseAtZero="false"
                    title="Price" />
        </mx:verticalAxis>

        <!-- horizontal axis -->
        <mx:horizontalAxis>
            <mx:CategoryAxis id="ca"
                    categoryField="@date"
                    title="Date"
                    labelFunction="categoryAxis_labelFunc" />
        </mx:horizontalAxis>

        <!-- horizontal axis renderer -->
        <mx:horizontalAxisRenderers>
            <mx:AxisRenderer axis="{ca}"
                    canDropLabels="true" />
        </mx:horizontalAxisRenderers>

        <!-- series -->
        <mx:series>
            <mx:LineSeries yField="@open"
                    form="curve"
                    displayName="Open" />
        </mx:series>

        <!-- series filters -->
        <mx:seriesFilters>
            <mx:Array />
        </mx:seriesFilters>
    </mx:LineChart>

</mx:Application>

View source is enabled in the following example.

<!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> <rdf:Description rdf:about="http://blog.flexexamples.com/2007/11/16/creating-a-custom-label-function-on-a-flex-linechart-controls-category-axis/" dc:identifier="http://blog.flexexamples.com/2007/11/16/creating-a-custom-label-function-on-a-flex-linechart-controls-category-axis/" dc:title="Creating a custom label function on a Flex LineChart control&#8217;s category axis" trackback:ping="http://blog.flexexamples.com/2007/11/16/creating-a-custom-label-function-on-a-flex-linechart-controls-category-axis/trackback/" /> </rdf:RDF> -->

分享到:
评论

相关推荐

    flex LineChart实例

    根据提供的文件信息,我们可以从标题、描述以及部分代码中提炼出与Flex LineChart相关的知识点。 ### Flex LineChart实例 #### 标题理解 标题“Flex LineChart实例”明确指出这是一个关于Flex框架下的线形图(Line...

    flex Chart

    2. **Chart类型**:除了柱状图,Flex Chart还包括线性图(LineChart)、饼图(PieChart)、面积图(AreaChart)等多种图表类型,每种都有其特定的用途和展示效果。 3. **图表系列(Series)**:每个图表由一个或多个...

    Flex Chart 使用教程(含源代码)

    Flex Chart 是Adobe Flex框架中的一个强大图表组件,用于在Flex应用程序中展示数据的图形化表示。这个使用教程包含了源代码,使得开发者无论是否熟悉ActionScript(AS)都能掌握其使用方法。下面将详细介绍Flex ...

    LineChart C#划曲线图

    这个控件是.NET Framework的一部分,位于System.Windows.Forms命名空间下,它提供了丰富的图表类型,包括线性图(LineChart)、柱状图(Histogram)和饼图(PieChart)。通过灵活地配置和设置各种属性,我们可以定制...

    ireport line chart Label 相關處理心得1

    本文主要讨论了在IReport中处理折线图(Line Chart)Label的一些关键点,这些知识点对于创建清晰、易读的图表至关重要。 1. **控制线显示**:在IReport的线图中,你可以选择一次性显示所有线条的Label,或者只显示...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Pie Plus Custom Chart Type - Building on the ability to create custom chart types, Dundas has created a new kind of pie chart that gives you far more visualization versatility. While all your ...

    LineChartDemo.zip

    《Android LineChart 示例详解》 在Android开发中,数据可视化是一项重要的任务,它能帮助用户更直观地理解复杂的数值信息。其中,折线图(LineChart)作为一种常见且直观的数据展示方式,常用于表现趋势变化或者...

    VC调用Microsoft Chart Control源码

    在本文中,我们将深入探讨如何在Visual C++ 6.0(简称VC6.0)环境中使用Microsoft Chart Control。这个控件是微软提供的一种强大的数据可视化工具,它允许开发者创建各种图表类型,如折线图、柱状图、饼图等,以便在...

    Android图表--achartengine

    All the above supported chart types can contain multiple series can be displayed with the X axis horizontally default or vertically and support many other custom features The charts can be built as a ...

    axis2 for c++ 1.6

    The Apache Axis2/C is a SOAP engine implementation that can be used to provide and consume Web Services. Axis2/C is an effort to implement Axis2 architecture, in C. Please have a look at ...

    Smobiler实现linechart源码

    本篇将详细介绍如何在Smobiler中实现线状图(LineChart)。 线状图是一种常见的图表类型,常用于展示数据随时间变化的趋势。在Smobiler中,我们可以使用其内置的图表组件来创建线状图,以便在移动应用中呈现动态和...

    Microsoft Chart Control, version 5.0

    微软图表控件(Microsoft Chart Control)是用于.NET Framework的一个组件,专为开发人员提供数据可视化功能。这个控件版本5.0提供了丰富的图形绘制能力,适用于Windows Forms和ASP.NET应用程序,使得开发人员能够...

    LineChart:一个简单的折线图

    在Java编程领域,创建数据可视化图表是常见的需求,其中折线图(LineChart)是一种直观展示数据趋势和变化的有效方式。本项目名为"LineChart:一个简单的折线图",显然是一个专注于展示如何在Java环境下生成简单折线...

    Control Freak 2 Touch Input2.2.3

    Control Freak 2 is a multi-platform input system that ...* With Control Freak Assistant you will be able to quickly create custom Input Rigs, complete with touch controls, with just a couple of clicks.

    MPchart多样化坐标轴

    首先,MPChart支持多种坐标轴,包括X轴(Horizontal Axis)和Y轴(Vertical Axis)。X轴通常用于表示数据的类别或者时间序列,而Y轴则用于展示数值的大小。MPChart允许开发者自定义坐标轴的显示方式,如刻度、标签、...

    Axis_API和axis2_API

    在IT行业中,Web服务是应用程序之间进行通信的一种标准方法,而Axis和Axis2是两种流行的Java SOAP(简单对象访问协议)框架,用于构建和消费Web服务。本文将深入探讨这两个API,以及它们在Web服务开发中的作用。 ...

    Microsoft SQL Server Reporting Services Recipes for Designing Expert Reports

    - Creating a Multi-Series Multi-Y Axis Chart - Interactive Reporting - Integrated Reporting Applications - Offline Reporting Using The Report Viewer Control - Creating a Calendar Report - Creating ...

    lineCharts

    Visifire让你利用ASP、A line chart or line graph is a type of chart which displays information as a series of data points called 'markers' connected by straight line segments.[1] It is a basic type of...

    BJJCZ_EZCAD2.0_Axis Control_ezcad_DEMO_axis_

    "BJJCZ_EZCAD2.0_Axis Control_ezcad_DEMO_axis_"这个标题暗示了我们正在讨论的是EzCAD 2.0版本的一个轴控相关的演示或示例模块。"Axis Control"指的是在EzCAD中对设备运动轴进行精确控制的功能,这对于实现精准的...

    axis和axis2的一些发布差异(WSDL2Java) 收藏

    ### Axis与Axis2在WSDL2Java工具中的发布差异 #### 概述 本文将详细介绍Axis与Axis2在使用WSDL2Java工具进行服务发布的差异性。这两种工具都是Apache项目的一部分,它们为开发者提供了强大的Web服务支持。其中,...

Global site tag (gtag.js) - Google Analytics