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

BarChart with differernt color

4 Answers 47 Views
Chart
This is a migrated thread and some comments may be shown as answers.
rahul
Top achievements
Rank 1
rahul asked on 23 Aug 2011, 12:45 PM
Question 1)
How can I make bars in a chart with different colors, by default it takes only first color from the Pallete Brushes and all the bars get created with the same color?? I don't want to go with Stacked Bar?/

Question 2)
How can I format the numbers in K . example 481000.23 should give 481.23 K

mapping1.SeriesDefinition.ItemLabelFormat =

 

"0, k";
The above format string gives 481 K but I wnat it as 481.23 K


These are very urgent issues!! Any help is appreciated.

Thanks,
Rahul Saxena

 

4 Answers, 1 is accepted

Sort by
0
rahul
Top achievements
Rank 1
answered on 23 Aug 2011, 02:50 PM
I got the solution for first question

mapping1.SeriesDefinition.LegendDisplayMode =

 

LegendDisplayMode.DataPointLabel; but reply for question 2 is still expecting.

 



Have one more question.
On X asis I have very big names(screen shot attched), datase column (FULL_NAME) which makes the charts unreadable,   I want to show only first 15 chars  only for display purpose, which I have stored in other column(FULL_NAME_TRIM).

How can I create the X axis with column FULL_NAME and only for display purpose I want to show FULL_NAME_TRIM.

Below  code give display as FULL_NAME, what change I shall do to draw the X Asix with column FULL_NAMEm but to display  FULL_NAME_TRIM

mapping1.ItemMappings.Add(

 

new ItemMapping("YAxis", DataPointMember.YValue));

 

mapping1.SeriesDefinition =

 

new BarSeriesDefinition();

 

mapping1.GroupingSettings.GroupDescriptors.Add(

 

new ChartGroupDescriptor("Group"));

 

mapping1.ItemMappings.Add(

 

new ItemMapping("FULL_NAME)", DataPointMember.XCategory));


Many Thanks.
Rahul

 

0
Evgenia
Telerik team
answered on 26 Aug 2011, 09:18 AM
Hello Rahul,

To your question regarding the ItemLabelFormat. Here is how your format should look like:
seriesMapping.SeriesDefinition.ItemLabelFormat = "#Y{0,.00} k";

To your latest question:
Why don't you set the ItemMapping's FieldName to FULL_NAME_TRIM and the DataPointMember to XCategory like this:
mapping1.ItemMappings.Add( new ItemMapping("FULL_NAME_TRIM)", DataPointMember.XCategory));

All the best,
Evgenia
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Mayra
Top achievements
Rank 1
answered on 25 Oct 2011, 03:47 PM
I have current a series with Y axis (number) and x axis ( percent) 
Can you please provide a example on how to have one series with different colors for the axis in the XAML code? In other words, Percent less than zero one color and percent greater than 0 other color. 
I would really appreciate your help.
0
Evgenia
Telerik team
answered on 28 Oct 2011, 12:43 PM
Hi Mayra,

Your scenario looks pretty much like our MVVM demo. You may also find our online documentation helpful for achieving it.

All the best,
Evgenia
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
rahul
Top achievements
Rank 1
Answers by
rahul
Top achievements
Rank 1
Evgenia
Telerik team
Mayra
Top achievements
Rank 1
Share this question
or