views:

212

answers:

3

Hi, I want to keep default color of lines and change line weight in Flex LineChart. How can I implement it?

Alternatively, if there any method for setting line weight or line color without using LineStroke?

Thanks.

A: 

Are you sure you can't do this by declaring something like

<mx:Stroke id="anID" weight="3"/> 

without a color property, and then referencing that in your LineStroke? That works for me.

Robusto
Thanks! How about in ActionScript ?
Sean Chen
private var aStroke:Stroke = new Stroke();aStroke.weight = 3;
Robusto
Sorry. I found that these methods still change color to "black" instead of keep the Flex default color.
Sean Chen
A: 

Try doing something like

for each (var series: LineSeries in chart.series) {
    (series.stroke as Stroke).weight = 2;
}

somewhere in commitProperties() or whatever like that.

Michael Pliskin
A: 

I'm doing something similar in my application. Here's how to just change the stroke, and keep all other existing properties:

for each (var series: LineSeries in this.lineChart.series) {
    var series_stroke:Stroke = series.getStyle('lineStroke') as Stroke;
    series_stroke.weight = 10;
    series.setStyle('lineStroke', series_stroke);
}

Sorry it's a bit late!

sdolan