Horizontal100stackedbarchart problem

6 posts, 0 answers
  1. Gary Blakely
    Gary Blakely avatar
    63 posts
    Member since:
    Jan 2010

    Posted 27 Mar 2010 Link to this post

    The helper class and code pasted below create a horizontal100bar chart that looks OK except that the left axis does not have the desired label which is a string containg a date contained in the "Played" field.  The line that is commented out is an attempt to insert the dates played as a label on the left YAxis but when included completely messes up the chart.  How can I get the Played values (always 9 of them) to appear on the left?

    By the way, If I only show the Birds, the played series prints just fine.
    Thanks, Gary
    (a .png of the graph produced is attached)   

    public class SummarySet
        {
            public SummarySet(string played, string birds, string pars, string bgys, string dbls, string trpls, string othrs)
            {
                this.Played = played;
                this.Birds = birds;
                this.Pars = pars;
                this.Bgys = bgys;
                this.Dbls = dbls;
                this.Trpls = trpls;
                this.Othrs = othrs;
            }
            public string Played { get; set; }
            public string Birds { get; set; }
            public string Pars { get; set; }
            public string Bgys { get; set; }
            public string Dbls { get; set; }
            public string Trpls { get; set; }
            public string Othrs { get; set; }
        }

                SummaryChart.Width = chartWidth * 1.5;
                SummaryChart.Height = chartHeight;
                SummaryChart.DefaultView.ChartTitle.Content = "Summary Last 9 Games";
                SeriesMapping sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Birds" });
                //sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.XCategory, FieldName = "Played" });
                sm.LegendLabel = "Birdies";
                SummaryChart.SeriesMappings.Add(sm);

                sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Pars" });
                sm.LegendLabel = "Pars";
                SummaryChart.SeriesMappings.Add(sm);

                sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Bgys" });
                sm.LegendLabel = "Bogeys";
                SummaryChart.SeriesMappings.Add(sm);

                sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Dbls" });
                sm.LegendLabel = "Doubles";
                SummaryChart.SeriesMappings.Add(sm);

                sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Trpls" });
                sm.LegendLabel = "Triples";
                SummaryChart.SeriesMappings.Add(sm);

                sm = new SeriesMapping();
                sm.SeriesDefinition = new HorizontalStackedBar100SeriesDefinition();
                sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Othrs" });
                sm.LegendLabel = "Others";
                SummaryChart.SeriesMappings.Add(sm);
                       
                SummaryChart.ItemsSource = data;

  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 31 Mar 2010 Link to this post

    Hi Gary,

    There seems to be an issue with the RadChart. We will investigate it.

    In the mean time, I suggest the following work-around:
    Handle the AxisX.TickPoints.CollectionChanged event and update the text of the tick points.


    Regards,
    Joshua
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Gary Blakely
    Gary Blakely avatar
    63 posts
    Member since:
    Jan 2010

    Posted 31 Mar 2010 Link to this post

    Joshua,
    Could you show me how to handle the AxisX.TickPoints.CollectionChanged event in C#?  I can't seem to find the object whose events I should subscribe to.  My entire code for producing this chart is pasted below...
    Thanks,
    Gary

     

     

    private void ProcessSummaryChart(GCService.GCServicePlayerDataClass myPlayerDataClass)

     

    {

     

    var SummaryData = myPlayerDataClass.summaryData;

     

     

    List<SummarySet> sdata = new List<SummarySet>();

     

     

    foreach (var s in SummaryData)

     

    {

    sdata.Add(

    new SummarySet(s.Played, s.Birds, s.Pars, s.Bgys, s.Dbls, s.Trpls, s.Othrs) );

     

    }

    CreateSummaryChart(sdata);

    }

     

    private void CreateSummaryChart(List<SummarySet> data)

     

    {

     

    SummaryChart.Width = chartWidth * 1.5;

    SummaryChart.Height = chartHeight;

    SummaryChart.DefaultView.ChartTitle.Content =

    "Summary Last 9 Games";

     

     

    SeriesMapping sm = new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Birds" });

     

     

    //sm.ItemMappings.Add(new ItemMapping() { DataPointMember = DataPointMember.XCategory, FieldName = "Played" });

     

     

     

     

    sm.LegendLabel =

    "Birdies";

     

    SummaryChart.SeriesMappings.Add(sm);

    sm =

    new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Pars" });

     

    sm.LegendLabel =

    "Pars";

     

    SummaryChart.SeriesMappings.Add(sm);

     

    sm =

    new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Bgys" });

     

    sm.LegendLabel =

    "Bogeys";

     

    SummaryChart.SeriesMappings.Add(sm);

    sm =

    new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Dbls" });

     

    sm.LegendLabel =

    "Doubles";

     

    SummaryChart.SeriesMappings.Add(sm);

    sm =

    new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Trpls" });

     

    sm.LegendLabel =

    "Triples";

     

    SummaryChart.SeriesMappings.Add(sm);

    sm =

    new SeriesMapping();

     

    sm.SeriesDefinition =

    new HorizontalStackedBar100SeriesDefinition();

     

    sm.ItemMappings.Add(

    new ItemMapping() { DataPointMember = DataPointMember.YValue, FieldName = "Othrs" });

     

    sm.LegendLabel =

    "Others";

     

    SummaryChart.SeriesMappings.Add(sm);

     

    SummaryChart.ItemsSource = data;

    }

    Helper class...

     

     

    public class SummarySet

     

     

     

     

    {

     

    public SummarySet(string played, string birds, string pars, string bgys, string dbls, string trpls, string othrs)

     

    {

     

    this.Played = played;

     

     

    this.Birds = birds;

     

     

    this.Pars = pars;

     

     

    this.Bgys = bgys;

     

     

    this.Dbls = dbls;

     

     

    this.Trpls = trpls;

     

     

    this.Othrs = othrs;

     

    }

     

    public string Played { get; set; }

     

     

    public string Birds { get; set; }

     

     

    public string Pars { get; set; }

     

     

    public string Bgys { get; set; }

     

     

    public string Dbls { get; set; }

     

     

    public string Trpls { get; set; }

     

     

    public string Othrs { get; set; }

     

    }

  4. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 02 Apr 2010 Link to this post

    Hi Gary,

    Here is a short example on how you can handle changes in tick points collection:
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
     
            this.RadChart1.DefaultView.ChartArea.AxisX.TickPoints.CollectionChanged += TickPoints_CollectionChanged;
        }
     
        private void TickPoints_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            foreach (var tickPoint in this.RadChart1.DefaultView.ChartArea.AxisX.TickPoints)
                tickPoint.Label = "aaa";
        }
    }


    Best,
    Joshua
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Gary Blakely
    Gary Blakely avatar
    63 posts
    Member since:
    Jan 2010

    Posted 02 Apr 2010 Link to this post

    Joshua,
    Thanks. That worked fine for now.  BTW, are there any docs on all of the events that can be handled for the various controls.  This would be most useful.
    Gary
  6. Velin
    Admin
    Velin avatar
    391 posts

    Posted 07 Apr 2010 Link to this post

    Hello Gary,

    We are constantly extending and improving our documentation. At present it does not cover such topics.

    All the best,
    Velin
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top