Line Chart changing colors

Thread is closed for posting
3 posts, 0 answers
  1. Sam
    Sam avatar
    19 posts
    Member since:
    Nov 2011

    Posted 23 Mar 2012 Link to this post

    Hi,

    I have a multiple line chart which may contain more than 10 lines, would i be able to assign a random and different color to it ?

    Thanks
  2. Sam
    Sam avatar
    19 posts
    Member since:
    Nov 2011

    Posted 23 Mar 2012 Link to this post

    Update:

    Have managed to change the line colours by generating a random colour, but how do I change the legend item colours to match the lines here is my code:

    Random randomGen = new Random();
    KnownColor[] names = (KnownColor[])Enum.GetValues(typeof(KnownColor));
    KnownColor randomColorName = names[randomGen.Next(names.Length)];
    Color randomColor = Color.FromKnownColor(randomColorName);
     
    MDChartSeries.Appearance.LineSeriesAppearance.Color = randomColor;

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 26 Mar 2012 Link to this post

    Sam:

    I think you will find a way to programmatically access the RadChart legend marker's and override the auto-generated colors by handling the "BeforeLayout" server-side event in the following forum thread:

    RadChart Legend/ Marker Color

    Hope this helps!
Back to Top