Thanks for your help,
Silvia
7 Answers, 1 is accepted
You can use Conditional formatting to change the color of the cell depending of the value. Please note that you should use aggregate functions in the Conditional Formatting expressions.
You can find attached our Crosstab example - Product Line Sales with added Conditional Formatting on textbox4.
Kind regards,
Hrisi
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

Now i have another question.
Thanks for your help,
Silvia
You can use the chart item's NeedDataSource event, which should have access to both the data item and pie item. Then based on the color from the data item - set the color through the appearance setting of the pie item.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

I'm trying it to decide if my company has to buy it.
I cant find the chart item's NeedDataSource event.
I see chart_NeedDataSource event that I've used to fill my chart in this way
Dim chartTorta As Telerik.Reporting.Processing.Chart = TryCast(sender, Telerik.Reporting.Processing.Chart)
chartTorta.DataSource =
Me.RiempiTortaTableAdapter1.GetData
but only this.
Now my pie is ok, but I want to make slices of cake in pie of a different color depending on a field of database.
How can i do?
Thanks for your help,
Silvia
Although used mainly for binding, the NeedDataSource event can also be used if you want to make any last minute changes to the definition chart item. So that is the correct place and following the instructions from my previous post, you should be able to achieve what you're after. You can review this KB article to see how to get the raw object data.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

Private
Sub torta_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles torta.NeedDataSource
Dim chartTorta As Telerik.Reporting.Processing.Chart = TryCast(sender, Telerik.Reporting.Processing.Chart)
Dim defChart As Telerik.Reporting.Chart = DirectCast(chartTorta.ItemDefinition, Telerik.Reporting.Chart)
chartTorta.DataSource =
Me.RiempiTortaTableAdapter1.GetData(103823)
End Sub
But now? How can I define color of different slice?

I have ran to this issue today as well. So to answer the question: "How can I define color of different slice?" here is smaple of my code to make it happen.
Private Sub chartVersionDetails_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chartVersionDetails.NeedDataSource
Dim chartVersionDetails As Telerik.Reporting.Processing.Chart = TryCast(sender, Telerik.Reporting.Processing.Chart)
Dim row As DataRow = (TryCast(chartVersionDetails.DataItem, System.Data.DataRowView)).Row
FilterTable(String.Concat("Version = '", row(1), "'"))
Dim chartVersionDetailsDef As Telerik.Reporting.Chart = DirectCast(chartVersionDetails.ItemDefinition, Telerik.Reporting.Chart)
Dim s As New ChartSeries()
s.Appearance.LabelAppearance.LabelLocation = Telerik.Reporting.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside
s.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Center
s.Type = ChartSeriesType.Pie
s.DefaultLabelValue = "#Y (#%)"
s.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels
For Each dtRow As DataRow In filtredTable.Rows
Dim item As New ChartSeriesItem()
item.YValue = DirectCast(row("Total"), Integer)
'Match proper color with the status in the slice
Select Case CInt(dtRow("StatusID"))
Case 0
item.Appearance.FillStyle.SecondColor = Color.Sienna
item.Appearance.FillStyle.SecondColor = Color.Wheat
Case 1
item.Appearance.FillStyle.MainColor = Color.WhiteSmoke
item.Appearance.FillStyle.SecondColor = Color.Violet
Case 2
item.Appearance.FillStyle.MainColor = Color.Red
item.Appearance.FillStyle.SecondColor = Color.RosyBrown
Case 3
item.Appearance.FillStyle.MainColor = Color.Purple
item.Appearance.FillStyle.SecondColor = Color.Pink
Case 4
item.Appearance.FillStyle.MainColor = Color.Salmon
item.Appearance.FillStyle.SecondColor = Color.RoyalBlue
End Select
s.Items.Add(item)
Next
chartVersionDetailsDef.Series.Clear()
chartVersionDetailsDef.Series.Add(s)
End Sub
1 thing to notice:
- there is not specified any datasource for the chart, because we hard code series manualy and assign them to the chart through: "chartVersionDetailsDef.Series.Add(s)". Like that we override what would be bound to the chart.
I hope this helps to somebody. ;-)