Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
FredFlex #1
Line Chart : How to specify a time X axis?
Hello,
I want to use Line Chart to show 2 series :
Serie 1:
{time : "2006-05-25 12:00:01", p1 : 45}
{time : "2006-05-25 13:00:01", p1 : 34}
{time : "2006-05-25 13:05:01", p1 : 78}
Serie 2:
{time : "2006-05-25 12:10:01", p1 :80}
{time : "2006-05-25 12:50:01", p1 : 56}
{time : "2006-05-25 13:00:01", p1 : 88}
The big problem is that when I show the chart, the x axis is not linear (I
would like something like 12:00:00, 12:15:00, etc... one mark each 15 minutes
with sample at the right place). How to do?
Thank for help me
FredFlex
FredFlex Guest
-
stacked Bar chart/Line chart hybrid- Charting
Hi all, I have a requirement to have a stacked bar graph, with a line graph on the same chart. Has anyone here done this before? Apparently there... -
On change of chart data linear axis title producingerror
I have a Column chart and a Line chart shown in different sections. Each section has a next/privious link that when clicked refreshes the data and... -
Formatting Chart Axis
Each Axis has a labelFunction property which takes a function as input. The provided function gets called to determine the label of axis labels. One... -
DRKv5 3D Line Chart line width, rendering problems
I am using the DevNet Resource Kit Version 5 3D Charting components. The line chart component has a minimum line width parameter, but the minimum... -
Simple line graphs (x-y axis) from ASP script
What is a straightforward way to generate a simple line graph from provided x-y data points in an ASP script. -
FredFlex #2
Re: Line Chart : How to specify a time X axis?
Finally I found:
I must use DateTimeAxis class
FredFlex Guest
-
poonamsheth #3
Re: Line Chart : How to specify a time X axis?
Data points on the DateTimeAxis support the String, Number, or Date data types.
1] Date: If the value of the data point is an instance of a Date object, it
already represents an absolute datetime value and needs no interpretation. It
is possible to pass a Date object as a data value if you use the parseFunction
property of the 2] DateTimeAxis. That function returns a Date object. For
more information, see Using parseFunction.
3] String: You can use any format that the Date.parse() method supports. The
supported formats are:
4] Day Month Date Hours:Minutes:Seconds GMT Year (for example, "Tue Feb 1
12:00:00 GMT-0800 2005")
5] Day Month Date Year Hours:Minutes:Seconds AM|PM (for example, "Tue Feb 1
2005 12:00:00 AM")
6] Day Month Date Year (for example, "Tue Feb 1 2005")
7] Month/Day/Year (for example, "02/01/2005")
8] Month/Year (for example, "02/01/2005")
You can also write custom logic that takes any string and returns a date using
the parseFunction property of the DateTimeAxis.
9] Number: If you use a number, it is assumed to be the number of milliseconds
since Midnight, 1/1/1970. For example, 543387600000. To get this value on an
existing Date object, use the Date object's getTime() method.
The following example uses a string value for the date that matches the
MM/DD/YYYY format and specifies that the
the example uses a string value and parseFunction:
------------------------------------------------------------------------
the parseFunction property of the DateTimeAxis tag to customize the value of
the data points. With this method, you specify a method that accepts a String
and returns a Date object.
The following example shows a parse function that creates a new Date object
out of strings in the data provider that match the "YYYY, MM, DD" pattern:
<mx:Script><![CDATA[
[Bindable]
public var aapl:Array = [
{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(",");
trace("y: " + a[0]);
trace("m: " + a[1]);
trace("d: " + a[2]);
// Create the new Date object.
var newDate:Date = new Date(a[0],a[1],a[2]);
return newDate;
}
]]></mx:Script>
<mx:LineChart id="mychart" dataProvider="{aapla}" showDataTips="true">
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="days" parseFunction="myParseFunction"/>
</mx:horizontalAxis>
<mx:series>
<mx:Array>
<mx:LineSeries yField="close" xField="date" displayName="AAPL"/>
</mx:Array>
</mx:series>
</mx:LineChart>
poonamsheth Guest



Reply With Quote

