Hi,
I would like to show temperature data every 15 minutes using line chart.
X axis shows time, Y axis shows temperature value of double type.
I want X axis label to show one scale every 15 minutes, or I can set the step of X axis. How can I do this ?
Attachment is my desirous effect.
Many thanks!
my codes:
private void ConfigureChart()
{
RadChart1.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;
RadChart1.DefaultView.ChartArea.EnableAnimations = true;
RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 20.0 / 192;
RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollOnly;
RadChart1.DefaultView.ChartArea.AxisX.Title = "??";
RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "HH:mm:ss";
RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelCount = 2;
RadChart1.DefaultView.ChartArea.AxisX.StepLabelLevelHeight = 15;
RadChart1.DefaultView.ChartArea.AxisX.IsDateTime = true;
//RadChart1.DefaultView.ChartArea.AxisX.MaxValue = 100;
//RadChart1.DefaultView.ChartArea.AxisX.MinValue = 0;
//RadChart1.DefaultView.ChartArea.AxisX.Step = 10;
//RadChart1.DefaultView.ChartArea.AxisX.LabelStep = 5;
RadChart1.DefaultView.ChartArea.AxisY.AutoRange = true;
RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
RadChart1.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;
RadChart1.DefaultView.ChartArea.AxisY.Title = "??";
SeriesMapping temperatureMapping = new SeriesMapping();
temperatureMapping.SeriesDefinition = new LineSeriesDefinition();
temperatureMapping.SeriesDefinition.ShowItemToolTips = true;
temperatureMapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue));
temperatureMapping.ItemMappings.Add(new ItemMapping("Temperature1", DataPointMember.YValue));
temperatureMapping.ItemMappings.Add(new ItemMapping("Tooltip1", DataPointMember.Tooltip));
RadChart1.SeriesMappings.Add(temperatureMapping);
}
private void FillSampleChartData()
{
List<TemperatureData> temperatureData = new List<TemperatureData>();
DateTime baseDate = new DateTime(2000, 1, 1);
int iCount = 192; // It captures Temperature Value every other fifteen minutes.
// there are 192 fifteen-minutes in two days
for (int year = 0; year < 1; year++)
{
for (int day = 0; day < 1; day++)
{
for (int hour = 0; hour < iCount; hour++)
{
TemperatureData tempData = new TemperatureData();
tempData.Temperature1 = TranslateTemperatureValue(CalculateBaseTemperatureValue(hour));
tempData.Date = baseDate;
temperatureData.Add(tempData);
baseDate = baseDate.AddMinutes(15);
}
}
}
RadChart1.ItemsSource = temperatureData;
}
<Grid x:Name="LayoutRoot">
<telerik:RadChart Height="600" HorizontalAlignment="Left" Name="RadChart1" VerticalAlignment="Top" Width="800" />
</Grid>