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

CandleStick - Bind X Axis?

1 Answer 25 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Hakki
Top achievements
Rank 1
Hakki asked on 07 Sep 2012, 04:31 PM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 10 Sep 2012, 11:38 AM
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.

Tags
Chart
Asked by
Hakki
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or