This is a migrated thread and some comments may be shown as answers.

TKChartAreaSeries question

2 Answers 42 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Konstantinos
Top achievements
Rank 1
Konstantinos asked on 13 May 2015, 02:57 PM

Hello again,

 In the TKChartAreaSeries when I use the 'default' settings I get for my graph the graph1.png which the lines are too thick and the fill not great...

 If I use the following settings (as in the documentation):

 

        let colorArray = [UIColor.whiteColor(), UIColor.blueColor()]
        lineSeries.style.palette = TKChartPalette()
        let paletteItem = TKChartPaletteItem()
        paletteItem.stroke = TKStroke(color: UIColor.blueColor())
        paletteItem.fill = TKLinearGradientFill(colors: colorArray)
        lineSeries.style.palette.addPaletteItem(paletteItem)

 

I get graph2.png that when the graph areas overlap only the latest one is shown and is not ideal... how can I make the graph lines thinner and keep the transparency of the areas instead of this 'last one wins'?

Thanks!

 

2 Answers, 1 is accepted

Sort by
0
Konstantinos
Top achievements
Rank 1
answered on 13 May 2015, 03:00 PM

Apologies for the confusion, the filenames are in reverse....

 

In the TKChartAreaSeries when I use the 'default' settings I get for my graph the graph2.png which the lines are too thick and the fill not great...

When I add the code above I get graph1.png that when the graph areas overlap only the latest one is shown and is not ideal... how can I make the graph lines thinner and keep the transparency of the areas instead of this 'last one wins'?  

 

0
Sophi
Telerik team
answered on 15 May 2015, 03:31 PM
Hi Konstantinos,

You can control the transparency of the area colors through the alpha component of each color.
If the alpha component has value 1.0 then the color is solid, if the alpha is 0.0 the color is completely transparent.
 
paletteItem.fill = TKSolidFill(color: UIColor(red: 1, green: 165/255, blue: 0, alpha: 0.7))

The line thickness can be controlled by setting stroke width.
paletteItem.stroke = TKStroke(color: UIColor.redColor(), width: 3)

Here is a code snippet for creating a transparent gradient. 
        let colorArray = [UIColor(red: 1, green: 1, blue: 1, alpha: 0.7), UIColor(red: 0.323, green:0.120 , blue: 0.2, alpha: 0.7)];
        lineSeries.style.palette = TKChartPalette()
        let paletteItem = TKChartPaletteItem()
        paletteItem.stroke = TKStroke(color: UIColor.redColor(), width0.5);
        paletteItem.fill = TKLinearGradientFill(colors: colorArray)
        lineSeries.style.palette.addPaletteItem(paletteItem)

I hope this helps.

Regards,
Sophi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Konstantinos
Top achievements
Rank 1
Answers by
Konstantinos
Top achievements
Rank 1
Sophi
Telerik team
Share this question
or