CandleStick - Bind X Axis?

2 posts, 1 answers
  1. Hakki
    Hakki avatar
    47 posts
    Member since:
    Sep 2012

    Posted 07 Sep 2012 Link to this post

    Hello,

    This chart works perfectly as intended except the X axis is 1,2,3,4 when I want it to show the values of the Visits themselves (2,6,9,10).

    Here is the code:
    MyRadChart.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;
     
                                    MyRadChart.DefaultView.ChartArea.AxisX.Title = "Visit";
     
                                    var seriesMapping = new SeriesMapping
                                        {
                                            SeriesDefinition = new CandleStickSeriesDefinition()
                                        };
     
                                    var itemMapping = new ItemMapping
                                    {
                                        DataPointMember = DataPointMember.Open,
                                        FieldName = "Q1Column"
                                    };
                                    seriesMapping.ItemMappings.Add(itemMapping);
     
                                    itemMapping = new ItemMapping
                                    {
                                        DataPointMember = DataPointMember.High,
                                        FieldName = "MaxColumn"
                                    };
                                    seriesMapping.ItemMappings.Add(itemMapping);
     
                                    itemMapping = new ItemMapping
                                    {
                                        DataPointMember = DataPointMember.Low,
                                        FieldName = "MinColumn"
                                    };
                                    seriesMapping.ItemMappings.Add(itemMapping);
     
                                    itemMapping = new ItemMapping
                                    {
                                        DataPointMember = DataPointMember.Close,
                                        FieldName = "Q3Column"
                                    };
                                    seriesMapping.ItemMappings.Add(itemMapping);
     
                                    MyRadChart.SeriesMappings.Add(seriesMapping);

    Any help is appreciated,

    Thanks.
  2. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 10 Sep 2012 Link to this post

    Hello Hakki,

    I see that you have not added an ItemMapping for the XCategory. You need to add one with the name of the property in mind:
    itemMapping = new ItemMapping
    {
     DataPointMember = DataPointMember.XCategory,
     FieldName = "VisitsCount"
    };
    seriesMapping.ItemMappings.Add(itemMapping);

    Greetings,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top