套件 | mx.charts |
類別 | public class DateTimeAxis |
繼承 | DateTimeAxis NumericAxis AxisBase EventDispatcher Object |
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The DateTimeAxis chooses the most reasonable units
to mark the axis by examining the range between the minimum and maximum
values of the axis.
The Axis chooses the largest unit that generates
a reasonable number of labels for the given range.
You can restrict the set of units the chart considers,
or specify exactly which units it should use,
by setting the labelUnits
property.
You can specifiy the minimum and maximum values explicitly,
or let the axis automatically determine them by examining
the values being renderered in the chart.
By default, the DateTimeAxis chooses the smallest possible range
to contain all the values represented in the chart.
Optionally, you can request that the minimum and maximum values
be rounded to whole units
(milliseconds, seconds, minutes, hours, days, weeks, months, years)
by setting the autoAdjust
property to true
.
You can specify disabled days of a week and disabled ranges of dates in order to show only working days on the axis but not all days between minimum and maximum. It also filters data and shows only data corresponding to working days on the chart
MXML 語法隱藏 MXML 語法The <mx:DateTimeAxis>
tag inherits all the properties
of its parent classes and adds the following properties:
<mx:DateTimeAxis Properties alignLabelsToUnits="true|false" dataUnits="milliseconds|seconds|minutes|hours|days|weeks|months|years" disabledDays="Array; No default" disabledRanges="Array; No default" displayLocalTime="false" interval="Number" labelUnits="milliseconds|seconds|minutes|hours|days|weeks|months|years" maximum="Date" minimum="Date" minorTickInterval="Number" minorTickUnits="milliseconds|seconds|minutes|hours|days|weeks|months|years" />
更多範例
相關 API 元素
屬性 | 定義自 | ||
---|---|---|---|
alignLabelsToUnits : Boolean
Determines the placement of labels along the axis. | DateTimeAxis | ||
autoAdjust : Boolean
Specifies whether Flex rounds values. | NumericAxis | ||
baseAtZero : Boolean
Specifies whether Flex tries to keep the minimum
and maximum values rooted at zero. | NumericAxis | ||
baseline : Number [唯讀]
The computed minimum value for the axis
as long as this value is greater than 0. | NumericAxis | ||
chartDataProvider : Object [唯寫]
The data provider assigned to the enclosing chart. | AxisBase | ||
computedMaximum : Number
The computed maximum value represented by this axis. | NumericAxis | ||
computedMinimum : Number
The computed minimum value represented by this axis. | NumericAxis | ||
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
dataInterval : Number [唯寫]
Specifies the interval between data in your chart,
specified in dataUnits. | DateTimeAxis | ||
dataUnits : String
Specifies the units that you expect the data in your chart to represent. | DateTimeAxis | ||
direction : String
Determines the direction in which the axis is rendered. | NumericAxis | ||
disabledDays : Array
The days to disable in a week. | DateTimeAxis | ||
disabledRanges : Array
Disables single and multiple days. | DateTimeAxis | ||
displayLocalTime : Boolean
When set to true,
a DateTimeAxis considers all date values to be in the time zone
of the client machine running the application. | DateTimeAxis | ||
displayName : String
The name of the axis. | AxisBase | ||
interval : Number
Specifies the number of labelUnits
between label values along the axis. | DateTimeAxis | ||
labelFunction : Function
Called to format axis values for display as labels. | NumericAxis | ||
labelUnits : String
The units that the axis uses to generate labels. | DateTimeAxis | ||
maximum : Date
Specifies the maximum value for an axis label. | DateTimeAxis | ||
minimum : Date
Specifies the minimum value for an axis label. | DateTimeAxis | ||
minorTickInterval : Number
Specifies the number of minorTickUnits
between minor tick marks along the axis. | DateTimeAxis | ||
minorTicks : Array [唯讀]
An Array of minor tick marks generated to represent this axis. | NumericAxis | ||
minorTickUnits : String
The units that the Axis considers when generating minor tick marks. | DateTimeAxis | ||
padding : Number
Specifies padding that Flex adds to the calculated minimum and maximum
values for the axis when rendering the values on the screen. | NumericAxis | ||
parseFunction : Function [覆寫]
Specifies a method that customizes the value of the data points. | DateTimeAxis | ||
title : String
The text for the title displayed along the axis. | AxisBase | ||
unitSize : Number [覆寫] [唯讀]
The width, in pixels, of a single data unit. | DateTimeAxis |
屬性 | 定義自 | ||
---|---|---|---|
assignedMaximum : Number
The explicitly assigned maximum value. | NumericAxis | ||
assignedMinimum : Number
The explicitly assigned minimum value. | NumericAxis | ||
computedInterval : Number
The computed interval represented by this axis. | NumericAxis | ||
dataDescriptions : Array [唯讀]
An Array of DataDescription structures describing the data being represented by the chart. | NumericAxis | ||
labelCache : Array
The most recent set of AxisLabel objects
generated to represent this axis. | NumericAxis | ||
labelMaximum : Number
The maximum value where a label should be placed. | NumericAxis | ||
labelMinimum : Number
The minimum value where a label should be placed. | NumericAxis | ||
minorTickCache : Array
The most recent set of minor tick marks generated to represent this axis. | NumericAxis | ||
requiredDescribedFields : uint [覆寫] [唯讀]
The fields of the DescribeData structure that this axis is interested in. | DateTimeAxis | ||
ticks : Array [唯讀]
An Array of tick marks for this axis. | NumericAxis |
方法 | 定義自 | ||
---|---|---|---|
Constructor. | DateTimeAxis | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | ||
Triggers events that inform the range object
when the chart data has changed. | AxisBase | ||
會將事件傳送到事件流程。 | EventDispatcher | ||
[覆寫]
Filters a set of values of arbitrary type
to a set of numbers that can be mapped. | DateTimeAxis | ||
Formats values for display in DataTips. | NumericAxis | ||
Determines the range to estimate what the axis labels should be. | NumericAxis | ||
Gets the labels text that is rendered. | NumericAxis | ||
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | ||
指出物件是否有已定義的指定屬性。 | Object | ||
Maps a position along the axis back to a numeric data value. | NumericAxis | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
Converts a set of values of arbitrary type
to a set of numbers that can be transformed into screen coordinates. | NumericAxis | ||
Determines how the axis handles overlapping labels. | NumericAxis | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
[覆寫]
Invoked when an AxisRenderer is unable to cleanly render
the labels without overlap, and would like the Axis object
to reduce the set of labels. | DateTimeAxis | ||
Each DataTransform that makes use of an axis
registers itself with that axis. | AxisBase | ||
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
[覆寫]
Maps a set of values from data space to screen space. | DateTimeAxis | ||
Each DataTransform that makes use of an axis
registers itself with that axis. | AxisBase | ||
Updates the chart. | NumericAxis | ||
會傳回指定之物件的基本值。 | Object | ||
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
方法 | 定義自 | ||
---|---|---|---|
Adjusts the generated or assigned range of the axis's labels. | NumericAxis | ||
Populates the labelCache property with labels representing the current
values of the axis. | NumericAxis | ||
[覆寫]
Builds an Array of positions for the minor tick marks Array that is generated by this axis. | DateTimeAxis | ||
Called by the governing DataTransform to obtain a description
of the data represented by this IChartElement. | AxisBase | ||
The default formatting function used
when the axis renders with day-based labelUnits. | DateTimeAxis | ||
The default formatting function used
when the axis renders with millisecond-based labelUnits. | DateTimeAxis | ||
The default formatting function used
when the axis renders with minute-based labelUnits. | DateTimeAxis | ||
The default formatting function used
when the axis renders with month-based labelUnits. | DateTimeAxis | ||
The default formatting function used
when the axis renders with second-based labelUnits. | DateTimeAxis | ||
The default formatting function used
when the axis renders with year-based labelUnits. | DateTimeAxis | ||
Protects the range against invalid values for this axis type. | NumericAxis | ||
Invalidates the cached labels and tick marks that represent this axis's values. | NumericAxis |
alignLabelsToUnits | 屬性 |
alignLabelsToUnits:Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Determines the placement of labels along the axis.
When false
, the chart always puts a label at the beginning of the axis. For example,
if your labels are every month and your first datapoint is July 14th, your first label
will be on July 14th. When true
, Flex first calculates the label units, then labels
the first whole interval of those units. For example, if your first data point was
July 14th, and your label units was months (set explicitly or dynamically calculated),
the first label will be on August 1st.
預設值為 true。
實作
public function get alignLabelsToUnits():Boolean
public function set alignLabelsToUnits(value:Boolean):void
dataInterval | 屬性 |
dataInterval:Number
[唯寫] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Specifies the interval between data in your chart,
specified in dataUnits
.
If, for example, the dataUnits
property
is set to "hours"
,
and dataInterval
property is set to 4,
the chart assumes your data occurs every four hours.
This affects how some series (such as ColumnSeries
and CandlestickSeries) render their data.
It also affects how labels are automatically chosen.
實作
public function set dataInterval(value:Number):void
相關 API 元素
dataUnits | 屬性 |
dataUnits:String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Specifies the units that you expect the data in your chart to represent. The value can be one of the following:
milliseconds
seconds
minutes
hours
days
weeks
months
years
This value is used in two ways.
First, when choosing appropriate label units,
a DateTimeAxis does not choose any unit smaller
than the units represented by the data.
If the value of the dataUnits
property
is days
, the chart would not render labels
for every hour, no matter what the minmium/maximum range is.
Secondly, the value of the dataUnits
property
is used by some series to affect their rendering.
Specifically, most columnar series
(such as ColumnSeries, BarSeries, CandlestickSeries, and HLOCSeries)
use the value of the dataUnits
property
to determine how wide to render their columns.
If, for example, your ColumnChart control's horizontal axis
had its labelUnits
property set to weeks
and its dataUnits
property set to days
,
the ColumnChart renders each column at 1/7th the distance
between labels.
When the dataUnits
property is set to null
, columnar series render
their columns as days, but the DateTimeAxis chooses
an appropriate unit when it generates the labels.
預設值為 null。
實作
public function get dataUnits():String
public function set dataUnits(value:String):void
disabledDays | 屬性 |
disabledDays:Array
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The days to disable in a week.
All the dates in a month, for the specified day, are disabled.
The elements of this array can have values from 0 (Sunday) to
6 (Saturday).
For example, a value of [ 0, 6 ]
disables Sunday and Saturday.
實作
public function get disabledDays():Array
public function set disabledDays(value:Array):void
disabledRanges | 屬性 |
disabledRanges:Array
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Disables single and multiple days.
This property accepts an Array of objects as a parameter.
Each object in this array is a Date object, specifying a
single day to disable; or an object containing either or both
of the rangeStart
and rangeEnd
properties,
each of whose values is a Date object.
The value of these properties describes the boundaries
of the date range.
If either is omitted, the range is considered
unbounded in that direction.
If you specify only rangeStart
,
all the dates after the specified date are disabled,
including the rangeStart
date.
If you specify only rangeEnd
,
all the dates before the specified date are disabled,
including the rangeEnd
date.
To disable a single day, use a single Date object specifying a date
in the Array.
The following example, disables the following dates: January 11 2006, the range January 23 - February 10 2006, and March 1 2006 and all following dates.
disabledRanges="{[ new Date(2006,0,11), {rangeStart:
new Date(2006,0,23), rangeEnd: new Date(2006,1,10)},
{rangeStart: new Date(2006,2,1)} ]}"
預設值為 []。
實作
public function get disabledRanges():Array
public function set disabledRanges(value:Array):void
displayLocalTime | 屬性 |
displayLocalTime:Boolean
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
When set to true
,
a DateTimeAxis considers all date values to be in the time zone
of the client machine running the application.
If false
, all values are in Universal Time
(Greenwich Mean Time).
實作
public function get displayLocalTime():Boolean
public function set displayLocalTime(value:Boolean):void
interval | 屬性 |
interval:Number
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Specifies the number of labelUnits
between label values along the axis.
Flex calculates the interval if this property is set to null
.
預設值為 null。
實作
public function get interval():Number
public function set interval(value:Number):void
labelUnits | 屬性 |
labelUnits:String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The units that the axis uses to generate labels.
By default, a DateTimeAxis considers all valid units
(milliseconds
, seconds
, minutes
, hours
, days
,
weeks
, months
, or years
).
If the labelUnits
property is not set,
the chart does not use any unit smaller than the value
of the dataUnits
property to render labels.
實作
public function get labelUnits():String
public function set labelUnits(value:String):void
maximum | 屬性 |
minimum | 屬性 |
minorTickInterval | 屬性 |
minorTickInterval:Number
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Specifies the number of minorTickUnits
between minor tick marks along the axis.
If this is set to NaN
,
the DateTimeAxis calculates it automatically.
Normally the minorTickInterval
property
is automatically set to 1.
If, however, the minorTickUnits
property
is the same units as the dataUnits
property
(either set explicitly or implicitly calculated),
then the minorTickInterval
property
is the maximum of 1, or dataInterval
.
實作
public function get minorTickInterval():Number
public function set minorTickInterval(value:Number):void
minorTickUnits | 屬性 |
minorTickUnits:String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The units that the Axis considers when generating minor tick marks.
By default, a DateTimeAxis considers all valid units
(milliseconds
, seconds
, minutes
, hours
, days
,
weeks
, months
, or years
).
If this property is not set, the chart determines the value
of the minorTickUnits
property.
If the label interval is greater than 1,
the minorTickUnits
property is set to the value
of the labelUnits
property,
and the minorTickInterval
property is set to 1.
If the label interval is 1, the minorTickUnits
property is
set to the next smaller unit from the labelUnits
property.
If set, the minorTickUnits
property can never be smaller
than the value of the dataUnits
property.
實作
public function get minorTickUnits():String
public function set minorTickUnits(value:String):void
parseFunction | 屬性 |
parseFunction:Function
[覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Specifies a method that customizes the value of the data points. With this property, you specify a method that accepts a value and returns a Date object. The Date object is then used in the DateTimeAxis object of the chart. This lets you provide customizable date input strings and convert them to Date objects, which Flex can then interpret for use in the DateTimeAxis.
Flex passes only one parameter to the parsing method. This parameter is the value of the data point you specified for the series. Typically, it is a String that represents some form of a date. You cannot override this parameter or add additional parameters.
This Date object is immediately converted to a numeric value,
so custom parseFunctions can reuse the same Date object
for performance reasons.
By default, the DateTimeAxis uses the string parsing functionality
in the ECMA standard Date.parse()
method.
parseFunction
uses these values to create a Date object
that the axis can use.
<mx:Script> import mx.collections.ArrayCollection; [Bindable] public var aapl:ArrayCollection = new ArrayCollection([ {date: "2005, 8, 1", close: 42.71}, {date: "2005, 8, 2", close: 42.99}, {date: "2005, 8, 3", close: 44} ]); public function myParseFunction(s:String):Date { // Get an array of Strings from the comma-separated String passed in. var a:Array = s.split(","); // Create the new Date object. Note that the month argument is 0-based (with 0 being January). var newDate:Date = new Date(a[0],a[1]-1,a[2]); return newDate; } </mx:Script> <mx:LineChart id="mychart" dataProvider="{aapl}" showDataTips="true"> <mx:horizontalAxis> <mx:DateTimeAxis dataUnits="days" parseFunction="myParseFunction"/> </mx:horizontalAxis> <mx:series> <mx:LineSeries yField="close" xField="date" displayName="AAPL"/> </mx:series> </mx:LineChart>
實作
override public function get parseFunction():Function
override public function set parseFunction(value:Function):void
requiredDescribedFields | 屬性 |
unitSize | 屬性 |
DateTimeAxis | () | 建構函式 |
public function DateTimeAxis()
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Constructor.
buildMinorTickCache | () | 方法 |
override protected function buildMinorTickCache():Array
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Builds an Array of positions for the minor tick marks Array that is generated by this axis.
Subclasses must implement this function. This function is called automatically
by the NumericAxis. You should access the minorTicks
property
instead of calling this function directly.
Array — An Array of positions from 0 to 1 that represent points between the axis
minimum and maximum values where minor tick marks are rendered.
|
filterCache | () | 方法 |
override public function filterCache(cache:Array, field:String, filteredField:String):void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Filters a set of values of arbitrary type to a set of numbers that can be mapped.
參數
cache:Array — An Array of objects where converted values
are read from and stored.
| |
field:String — The field of the objects in the cache Array
containing the pre-filtered values.
| |
filteredField:String — The field of the objects in the cache Array
where filtered values should be stored.
|
formatDays | () | 方法 |
protected function formatDays(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with day-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method to provide
alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
formatMilliseconds | () | 方法 |
protected function formatMilliseconds(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with millisecond-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method
to provide alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
formatMinutes | () | 方法 |
protected function formatMinutes(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with minute-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method
to provide alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
formatMonths | () | 方法 |
protected function formatMonths(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with month-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method to
provide alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
formatSeconds | () | 方法 |
protected function formatSeconds(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with second-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method to
provide alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
formatYears | () | 方法 |
protected function formatYears(d:Date, previousValue:Date, axis:mx.charts:DateTimeAxis):String
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The default formatting function used
when the axis renders with year-based labelUnits
.
If you write a custom DateTimeAxis class, you can override this method
to provide alternate default formatting.
You do not call this method directly. Instead, Flex calls this method before it renders the label to get the appropriate String to display.
參數
d:Date — The Date object that contains the unit to format.
| |
previousValue:Date — The Date object that contains the data point that occurs
prior to the current data point.
| |
axis:mx.charts:DateTimeAxis — The DateTimeAxis on which the label is rendered.
|
String — The formatted label.
|
reduceLabels | () | 方法 |
override public function reduceLabels(intervalStart:AxisLabel, intervalEnd:AxisLabel):AxisLabelSet
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Invoked when an AxisRenderer is unable to cleanly render the labels without overlap, and would like the Axis object to reduce the set of labels. The method is passed the two labels that are overlapping.
參數
intervalStart:AxisLabel — The start of the interval where labels overlap.
| |
intervalEnd:AxisLabel — The end of the interval where labels overlap.
|
AxisLabelSet — A new label set that resolves the overlap by reducing
the number of labels.
|
transformCache | () | 方法 |
override public function transformCache(cache:Array, field:String, convertedField:String):void
語言版本: | ActionScript 3.0 |
產品版本: | Flex 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Maps a set of values from data space to screen space.
參數
cache:Array — An Array of objects where mapped values
are read from and stored.
| |
field:String — The field of the objects in the cache Array
containing the pre-mapped values.
| |
convertedField:String — The field of the objects in the cache Array
where mapped values should be stored.
|
<?xml version="1.0"?> <!-- Simple example to demonstrate the DateTimeAxis class. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] public var stockDataAC:ArrayCollection = new ArrayCollection( [ {date: "2005, 7, 27", close: 41.71}, {date: "2005, 7, 28", close: 42.21}, {date: "2005, 7, 29", close: 42.11}, {date: "2005, 8, 1", close: 42.71}, {date: "2005, 8, 2", close: 42.99}, {date: "2005, 8, 3", close: 44} ]); public function myParseFunction(s:String):Date { // Get an array of Strings from the comma-separated String passed in. var a:Array = s.split(","); // Create the new Date object. Subtract one from // the month property because months are zero-based in // the Date constructor. var newDate:Date = new Date(a[0],a[1]-1,a[2]); return newDate; } ]]> </fx:Script> <mx:Panel title="DateTimeAxis Example" height="100%" width="100%"> <mx:LineChart id="mychart" height="100%" width="100%" paddingRight="5" paddingLeft="5" showDataTips="true" dataProvider="{stockDataAC}"> <mx:horizontalAxis> <mx:DateTimeAxis dataUnits="days" parseFunction="myParseFunction"/> </mx:horizontalAxis> <mx:verticalAxis> <mx:LinearAxis baseAtZero="false" /> </mx:verticalAxis> <mx:series> <mx:LineSeries yField="close" xField="date" displayName="AAPL"/> </mx:series> </mx:LineChart> </mx:Panel> </s:Application>
Tue Jun 12 2018, 03:47 PM Z