how to show common legnd label in silverlight

4 posts, 0 answers
  1. Asiq Raja
    Asiq Raja avatar
    30 posts
    Member since:
    Jul 2010

    Posted 09 Mar 2011 Link to this post

    HI,,

            now i m try to do the multiple y-Axis, and i have done that too, but i need to do the differentiate the bars in different color, each color represent Event type. but i want to set colors too.
    1, Event type 1 = Blue color
    2,Event type 2 = Green color
    3,Event type 3 = Brown color,. etc...

    my code:-
                        EventBarChart.DefaultView.ChartArea.AdditionalYAxes.Add(new AxisY());
                        EventBarChart.DefaultView.ChartArea.AdditionalYAxes.Add(new AxisY());
                        EventBarChart.DefaultView.ChartArea.AdditionalYAxes[0].AxisName = "EventValue";
                        EventBarChart.DefaultView.ChartArea.AdditionalYAxes[1].AxisName = "EventType";

                        EventBarChart.DefaultView.ChartLegend.Header = "Event Types";
                        this.EventBarChart.DefaultView.ChartLegend.LegendItemMarkerShape = MarkerShape.StarFiveRay;

                        List<int> legendlist = new List<int>();
                        foreach (var item in EventLoglst)
                        {             
                            /* To create multiple data Series to bind the chart */
                            DataSeries seriesType = new DataSeries();
                            DataSeries seriesValue = new DataSeries();
                            seriesValue.Add(new DataPoint(item.Dates, item.EventValue));

                                legendlist.Add(item.EventType);
                                seriesValue.LegendLabel = "Event Type -" + item.EventType.ToString();                    
                       
                             EventBarChart.DefaultView.ChartArea.DataSeries.Add(seriesValue);
                          }

    its working properly but , i need to show the bar and legend labels ,

    here with i have attached my chart, and another one is how i need the chart legend label.

    Regards
    M. Asiq Raja
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Mar 2011 Link to this post

    Hello Asiq,

    As I understand from your explanation you want each Bar from one Serie in different color and the AxisName next to it's Legend Name. You can achieve this by using the LegendDisplayMode property of the Chart as describe in our help topic.
    Set the property to DataPointLabel and the Legend will display automatically an item for each DataPoint in your series and each series item will be marked with a different color. 

    Regards,
    Evgenia
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Asiq Raja
    Asiq Raja avatar
    30 posts
    Member since:
    Jul 2010

    Posted 15 Mar 2011 Link to this post

    HI Evgenia ,

           Thanks for the reply.  Actually i have tried these methods, but what i need is,, let me explain,

    in my project i have event types. and event values, for every event type, there should be a collection of event values, and all these event can occur every day, so here i have to show  every day how many events happen and its event values. now i can able to show the required way. but now i want to  differentiate the bars as well as user friendly, so i try to set the color for every bar
    eg:-
    Bar -1 = Blue
    Bar -2 = Green
    Bar -3 = Orange,  like..

    so the end users can able to understand the easily.  k Now u have some good understand what i m try to do,,  now i want to show the bars in required color( as well as different colors), and have to show the legend label common for all, the legend label should show only based one the event type( but the legend label should not repeat again, and that labels can show its appropriate color same as chart bar) .

    Reference page is check telerik multiple Y axis support .( check its legend label And bars).

    THanks & Regards
        M.Asiq Raja
  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 17 Mar 2011 Link to this post

    Hello Asiq Raja,

    Could you send us a sample image representing what do you want to achieve? Also it will be helpful if you provide us the data used to populate the Chart. The images you sent in your previous post were equal and we couldn't understand what are your requirements.

    Looking forward to hearing from you!

    Kind regards,
    Evgenia
    the Telerik team
Back to Top