CartesianDataCanvas

I'm trying to shoot on a Flex ColumnChart to add lines of tendency for the grouped items. The graph XAxis has 3 groups (5 credits and below, 6 or 7 and 8 credits or more) and within each of these groups, three years of data for the school in question. I have to add a trendline to the School Board on the top of each of these groups (so that each group has its own trend line). I can easily add a trend that crosses groups (using the methods moveTo and lineTo CartesianDataCanvas), but this isn't the desired effect.

Is it possible to pass a variable group-name not to these methods? Whenever I spend a certain number, the drawing fails silently. If I pass the name of the group, the trend will not draw correctly (it just pulls straight up and down to the central point of the Group).

Any help would be greatly appreciated.

I finally got it working!

I use the maximum yAxis and the height properties CartesianDataCanvas to understand data value shifts and to loop through the ColumnSeries.item table to look at their x value itemRenderer. I combine it with the actual data and then use CartesianDataCanvas.graphics.moveTo and CartesianDataCanvas.graphics.lineTo (instead of the methods moveTo and lineTo the CartesianDataCanvas itself). It took 3 days to make it work, but it works!

Here's the working solution (a nice nightmare in loop!)...


http://www.Adobe.com/2006/mxml"layout ="absolute ".
backgroundColor = "#FFFFFF" backgroundAlpha = backgroundGradientColors '1' = 'null '.
creationComplete = "init ()" "
>

Import mx.charts.series.items.ColumnSeriesItem;
Import mx.collections.ArrayCollection;

[Bindable]
private var _dataGroups:ArrayCollection = new ArrayCollection([)
{
label: '' 2004-05.
DataKey: "_data1."
},
{
label: "2005 - 06',
DataKey: "_data2."
},
{
label: ' 2006-07'.
DataKey: "_data3."
}
]);
[Bindable]
private var _dataSchool:ArrayCollection = new ArrayCollection([)
{
_group: ' 5 credits or less. "
_data1: 15.
_data2: 10.
_data3: 5
},
{
_group: 6 or 7 credits
_data1: 20.
_data2: 15.
_data3: 10
},
{
_group: "8 credits or more.
_data1: 65,.
_data2: 75,.
_data3: 85
}
]);
[Bindable]
private var _dataBoard:ArrayCollection = new ArrayCollection([)
{
_group: ' 5 credits or less. "
_data1: 20.
_data2: 15.
_data3: 10
},
{
_group: 6 or 7 credits
_data1: 25,.
_data2: 20.
_data3: 15
},
{
_group: "8 credits or more.
_data1: 55,.
_data2: 65,.
_data3: 75
}
]);
private function setTrend (): void {}
chart_canvas. Graphics.Clear ();
(chart_canvas). Graphics.LineStyle
1,
0 x 336699,
. 5.
true,
LineScaleMode.NORMAL,
CapsStyle.ROUND,
JointStyle.MITER,
2
);
Calculate the offset of the data for drawing
var yAxisMax:int = yAxis.maximum;
var yAxisHeight:int = chart_canvas.height;
var dataOffset:Number = yAxisHeight / yAxisMax;
Generate the data table
var dataArray:Array = new Array (chart.series.length);
for (var i: int = 0; i< dataarray.length;="">
dataArray = new Array();
}
Fill in the data table
for (i = 0; i< chart.series.length;="">
var columnSeries:ColumnSeries = chart.series
as ColumnSeries;
for (var j: int = 0; j< columnseries.items.length;="">
var columnSeriesItem:ColumnSeriesItem = columnSeries.items [j] as ColumnSeriesItem;
var xPos:Number = columnSeriesItem.itemRenderer.x + (columnSeriesItem.itemRenderer.width / 2);
var yPos:Number = yAxisHeight - (_dataBoard.getItemAt (j) ["_data" + (i + 1)] * dataOffset);
if(i == 0) {}
dataArray [j] .push (new Point (xPos, yAxisHeight));
}
dataArray [j] .push (new Point (xPos, yPos));
If (i == chart.series.length - 1) {}
dataArray [j] .push (new Point (xPos, yAxisHeight));
}
}
}
Call on the CartesianDataCanvas
chart_canvas. Graphics.beginFill (0xFFFF00, 0.10);
for (i = 0; i< dataarray.length;="">
var dataSet:Array = dataArray like table;
for (j = 0; j< dataset.length;="">
var: a Point = [j] dataSet as Point;
if(j == 0) {}
chart_canvas. Graphics.MoveTo (point.x, point.y);
chart_canvas. Graphics.LineStyle (0 x 336699, 1, 0);
} else {}

chart_canvas. Graphics.LineTo (point.x, point.y);
(chart_canvas). Graphics.LineStyle
3,
0 x 336699,
. 75.
true,
LineScaleMode.NORMAL,
CapsStyle.ROUND,
JointStyle.MITER,
2
);
If (j == dataSet.length - 2) {}
chart_canvas. Graphics.LineStyle (0 x 336699, 1, 0);
}
}
}
}
chart_canvas. Graphics.endFill ();
}
]]>



















Tags: Flex

Similar Questions

  • Print the graphics that contain the Cartesian Web

    Now that I'm able to add trend lines to our graphics as shown here, I'm having a problem with printing. When the cards are moved from their original canvas to canvas printing (and then back), the trend that are drawn lines are deleted.

    Is this expected behavior? If so, is there a way around it (an event that I can catch maybe?)?

    Thank you
    Greg.

    I found a solution. It's probably not the most elegant, but it works...

    There are now 2 items in my table of annotationElements. 1 is the CartesianDataCanvas, the 2nd is a simple canvas. I use the CartesianDataCanvas simply to get the height of the yAxis (I can't find this value anywhere else). I then pull the canvas (not the CartesianDataCanvas) and everything is going well.

Maybe you are looking for

  • Qosmio F20-137: WLan connection falls very quickly from 54mbs to 1mbs

    I connect to internet using my F20-137 via a linksys g wireless router. The router is in another room (25 feet and on two walls) for the laptop computer and the connection very quickly falls to 54mbs to 1mbs.Is it possible to maintain the speed of co

  • I am looking for a Windows Live ID moderator to help me with my account.

    I had my account closed and reopened, then after that I spent several days tracked someone down who might help. I then had access for about a day now it closes and nobody seems to be able to help me. I have used all the means on your site and also ha

  • DELL INSPIRON N4010... SAYS WEBCAM NOT INSTALLED... INTERGRATED

    try video calling friends I can hear them but can not see... Herald says webcam not detected.

  • Help the CBO to make the right choice

    Hello everyone. I have a related question performance. I would like to hear your opinion on this. Here's a simple query on the transactions table: SELECT      * FROM      transaction t WHERE          t.transaction_method_type_code = 'CREDIT'      AND

  • Muse width 100% Adobe content

    Hello! I'm trying to follow this tutorial: Adobe Muse Tutorial - Responsive Design Hack! of MuseThemes.com - YouTubeThe idea is that by using the text box, which makes 100% width, then cut and paste your content into it, it will be sensitive like tha