Bar chart with different colors

Thread is closed for posting
3 posts, 0 answers
  1. jayanthi
    jayanthi avatar
    111 posts
    Member since:
    Jul 2010

    Posted 03 Jun 2013 Link to this post

    Hello,

    Using web application, i need to draw BAR chart.
    I have the following details in database

    EmployeeId Score Result Date

    E001            20      Fail     01-05-2012
    E002            80      Pass     01-05-2012
    E003            85       Pass       02-05-2012
    E001             60      Pass       03-05-2012
    E001             86       Pass      01-06-2012  
    E002            80      Pass     01-06-2012
    E003            85       Pass       01-06-2012

    need to prepare bar chart for the above employees.
    There may be many employees but each employees bar should be displayed with unique colors. Also Legend should display Employee Id with its respective bar color.
    Eg: E001 as Red, E002 as Pink, E003 as Blue .........

    Its urgent.
    Thank you
    jayanthi
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jun 2013 Link to this post

    Hi,

    Please check this help documentation to assign Individual Colors to Bars.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. jayanthi
    jayanthi avatar
    111 posts
    Member since:
    Jul 2010

    Posted 04 Jun 2013 Link to this post



    Dim barColors As Drawing.Color() = New Color(4) {Color.Purple, Color.SteelBlue, Color.Aqua, Color.Yellow, Color.Red}

    For the above code Is it possible to assign bar colors from database?

    Also the below code throws an error "Index was outside the bounds of the array".

    Dim i As Integer = 0
    For Each item As Telerik.Reporting.Charting.ChartSeriesItem In rpt.Chart1.Series(0).Items
                item.Appearance.FillStyle.MainColor = barColors(System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1))
            Next

    How to rectify it?

    Thank you
Back to Top