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

XAxis interval by 1 month

2 Answers 48 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sowjanya
Top achievements
Rank 1
Sowjanya asked on 10 Jul 2013, 04:08 AM
double oneMinute = 1 / 1440d;
                double tenMinutes = 10 / 1440d;
                double fourHours = 4 / 24d;
                double oneDay = 24 / 24d; // one day = 24 hours
                double fiveDays = 120 / 24d;
  
                double startTime = dataSeries[0].XValue;
                double endTime = dataSeries[dataSeries.Count - 1].XValue;
  
                double start365Time = HouseConsumptionData.First().TimeStamp.ToOADate();
                double end365Time = HouseConsumptionData.Last().TimeStamp.ToOADate();
  
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "HH:mm:ss";
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.AutoRange = false;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.MinValue = startTime;
                houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.MaxValue = endTime;
                // Five Minutes Interval 
                if (selectedInterval == EMIntervalEnum.Five_Minutes)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = oneMinute;
                }
                // One Hour Interval
                else if (selectedInterval == EMIntervalEnum.One_Hour)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = tenMinutes;
                }
                // 24 Hours interval
                else if (selectedInterval == EMIntervalEnum.One_Day)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = fourHours;
                }
                // 7 days interval
                else if (selectedInterval == EMIntervalEnum.One_Week)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = oneDay;
                }
                // 30 days interval
                else if (selectedInterval == EMIntervalEnum.One_Month)
                {
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd MMM yyyy";
                    houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.Step = fiveDays;
                }
                //365 days interval
                else if (selectedInterval == EMIntervalEnum.One_Year)
                {
                     // Looking for solution
                }

Hi,
We are using Rad Charts for silverlight Q1 2013, I have a requirement where we have to show data for 1 day, 1 week,  1month and 365 days [1 year]. I am able to achieve all the intervals otherthan 365 days where I have to divide X-Axis steps by 1 month.        
Could you please let me know, if this feature can be achieved with the version I am using. I will have to show data in dd MMM yyyy format like 01 Jan 2012, 01 Feb 2012...... 01 Jan 2013 e.t.c.,                     Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 11 Jul 2013, 03:44 PM
Hi Sowjanya,

Please, use RadChartView for Silverlight, which is designed to handle this scenario. Depending on the specifics you can use DateTimeContinuousAxis or DateTimeCategoricalAxis. Please, find more details in this help topic.


Best regards,
Ves
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sowjanya
Top achievements
Rank 1
answered on 12 Jul 2013, 03:45 AM
Hi Ves,
  Thanx for replying. At this point of time, I can't change my chart Since there are other data intervals, bounded to the same chart. I somehow managed to achieve this by first dividing steps by 30 days and changing label to the desired date in the layout updated event, Code snippet attached.
   
double thirtyDays = 720 / 24d;
  radChart.DefaultView.ChartArea.AxisX.Step = thirtyDays;
  
if (selectedInterval == EMIntervalEnum.One_Year)
                {
                    // Looping to Cutomize label
                    for (int i = 0; i < houseConsumption.HouseConsumptionChart.DefaultView.ChartArea.AxisX.TickPoints.Count - 1; i++)
                    {
                        radChart.DefaultView.ChartArea.AxisX.TickPoints[i].Label = HouseConsumptionData[i].TimeStamp.ToString("dd MMM yy");
                    }
                }
Tags
Chart
Asked by
Sowjanya
Top achievements
Rank 1
Answers by
Ves
Telerik team
Sowjanya
Top achievements
Rank 1
Share this question
or