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

Bar chart with different colors

2 Answers 27 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
jayanthi
Top achievements
Rank 1
jayanthi asked on 03 Jun 2013, 10:00 AM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 03 Jun 2013, 12:21 PM
Hi,

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

Thanks,
Shinu.
0
jayanthi
Top achievements
Rank 1
answered on 04 Jun 2013, 10:24 AM


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
Tags
Chart (Obsolete)
Asked by
jayanthi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
jayanthi
Top achievements
Rank 1
Share this question
or