TKChartAreaSeries question

3 posts, 0 answers
  1. Konstantinos
    Konstantinos avatar
    4 posts
    Member since:
    May 2015

    Posted 13 May 2015 Link to this post

    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. Konstantinos
    Konstantinos avatar
    4 posts
    Member since:
    May 2015

    Posted 13 May 2015 in reply to Konstantinos Link to this post

    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'?  

     

  3. DevCraft banner
  4. Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 15 May 2015 Link to this post

    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
Back to Top