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

multiple Y axes with same bar color

1 Answer 75 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Avi
Top achievements
Rank 1
Avi asked on 19 Jul 2011, 03:08 PM
Hello,

I'm creating a chart with multiple Y axes. and my problem is the color of the bars are the same color instead to be different. I'm using mvvm and binding data.

I will be happy getting your support fixing it.

Thanks,

Here is the code :

 <telerik:RadChart x:Name="ReportChart"
                                  ItemsSource="{Binding PaymentsPerDateCollection}"  
                                  Visibility="{Binding IsPaymentsPerDateChartVisible,Converter={StaticResource boolToVisibilityConverter}}">
                    
                    <telerik:RadChart.DefaultView>                                                
                        <telerik:ChartDefaultView>
                            
                            <!--  Title  -->
                            <telerik:ChartDefaultView.ChartTitle>
                                <telerik:ChartTitle Visibility="Collapsed" />
                            </telerik:ChartDefaultView.ChartTitle>

                            <!--  Legend  -->
                            <telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartLegend Visibility="Collapsed" />
                            </telerik:ChartDefaultView.ChartLegend>
                            
                            <!--  ChartArea  -->
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea ItemWidthPercent="30"
                                                   LabelFormatBehavior="Scientific"
                                                   SmartLabelsEnabled="True">
                                    <!--  Axis X  -->
                                    <telerik:ChartArea.AxisX>
                                        <telerik:AxisX DefaultLabelFormat="MMM-yyyy"
                                                       IsDateTime="True"
                                                       LabelRotationAngle="-25"
                                                       LayoutMode="Inside">
                                        </telerik:AxisX>
                                    </telerik:ChartArea.AxisX>
                                    <!--  Axis Y  -->
                                    <telerik:ChartArea.AxisY>
                                        <telerik:AxisY Title="{Binding AppStrings.PaidAmount, Source={StaticResource StringsLocator}}"
                                                       DefaultLabelFormat="c"
                                                       Visibility="Collapsed">
                                        </telerik:AxisY>
                                    </telerik:ChartArea.AxisY>
                                    <!--  Axis AdditionalYAxes  -->
                                    <telerik:ChartArea.AdditionalYAxes>
                                        <telerik:AxisY x:Name="secondaxis" AxisName="Secondary" Title="{Binding AppStrings.PaidAmount, Source={StaticResource StringsLocator}}"
                                                       DefaultLabelFormat="c"
                                                       Visibility="Collapsed">
                                        </telerik:AxisY>
                                    </telerik:ChartArea.AdditionalYAxes>
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>                           

                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>  
                    
                    <telerik:RadChart.SeriesMappings>
                        <telerik:SeriesMapping>
                           <telerik:SeriesMapping.SeriesDefinition>
                                <telerik:BarSeriesDefinition ItemLabelFormat="#Y{C0}"
                                                             LegendDisplayMode="DataPointLabel"
                                                             Visibility="Visible"/>
                            </telerik:SeriesMapping.SeriesDefinition>
                           <telerik:SeriesMapping.ItemMappings>
                                <telerik:ItemMapping DataPointMember="YValue" FieldName="PaymentAmount" />
                                <telerik:ItemMapping DataPointMember="XCategory" FieldName="HandledOn" />
                            </telerik:SeriesMapping.ItemMappings>
                        </telerik:SeriesMapping>
                        <telerik:SeriesMapping>
                            <telerik:SeriesMapping.SeriesDefinition>                              
                                <telerik:BarSeriesDefinition AxisName="Secondary" ItemLabelFormat="#Y{C0}"
                                                             LegendDisplayMode="DataPointLabel"
                                                             Visibility="Visible"/>
                            </telerik:SeriesMapping.SeriesDefinition>
                            <telerik:SeriesMapping.ItemMappings>
                                <telerik:ItemMapping DataPointMember="YValue" FieldName="DepositAmount" />
                                <telerik:ItemMapping DataPointMember="XCategory" FieldName="HandledOn" />
                            </telerik:SeriesMapping.ItemMappings>
                        </telerik:SeriesMapping>                       
                    </telerik:RadChart.SeriesMappings>                  
                </telerik:RadChart>
 - Themes - XOOPS News ...
www.xoops.org/modules/news/article.php?storyid=4364 - Cached

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 21 Jul 2011, 03:55 PM
Hello Avi,
I reviewed your code and it looks correct. As you can see on our online demo - http://demos.telerik.com/silverlight/#Chart/MultipleYAxes, the series show as expected on our side. That is why, I suppose there is something specific to your setup that leads to the described result. For example, in case you have code that sets the color for each bar, you might use the same code for both series. However, I cannot be sure what exactly is causing the problem, unless I am able to reproduce it locally. That is why, please open a formal support ticket and send me a running test project, demonstrating the problem. I will review the code and do my best to help you fix it.

All the best,
Tsvetie
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
Avi
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or