XAxis interval by 1 month

3 posts, 0 answers
  1. Sowjanya
    Sowjanya avatar
    8 posts
    Member since:
    May 2013

    Posted 09 Jul 2013 Link to this post

    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. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 11 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Sowjanya
    Sowjanya avatar
    8 posts
    Member since:
    May 2013

    Posted 11 Jul 2013 Link to this post

    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");
                        }
                    }
Back to Top