I want to add Strings beneath my chart, i dont understand why this doesnt work.
my sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XValue));
Should Show GAS for no.1 and Electricity for no.2
But i cant get it working? im sending u a picture in the picture u can see that the first number is gas and the value for this week and last week and same for number two. I want to change the names to GAS and Electricity
public void GenerateChart()
{
SeriesMapping sm = new SeriesMapping();
sm.LegendLabel = "Comparrison of the Past 7 days, with the folowoing 7 days (€)";
smartHomeChart.DefaultView.ChartTitle.Content = "Comparison Chart";
smartHomeChart.DefaultView.ChartLegend.UseAutoGeneratedItems = false;
ChartLegendItem item1 = new ChartLegendItem();
item1.Label = "Previous week";
item1.MarkerFill = new SolidColorBrush(Colors.LightSkyBlue);
smartHomeChart.DefaultView.ChartLegend.Items.Add(item1);
ChartLegendItem item2 = new ChartLegendItem();
item2.Label = "This week";
item2.MarkerFill = new SolidColorBrush(Colors.PaleVioletRed);
smartHomeChart.DefaultView.ChartLegend.Items.Add(item2);
smartHomeChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
smartHomeChart.DefaultView.ChartArea.AxisX.AutoRange = false;
smartHomeChart.DefaultView.ChartArea.AxisX.MinValue = 40839.00;
smartHomeChart.DefaultView.ChartArea.AxisX.MaxValue = 40845.00;
smartHomeChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
smartHomeChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";
sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XValue));
sm.ItemMappings.Add(new ItemMapping("DezeWeek", DataPointMember.YValue));
sm.ItemMappings.Add(new ItemMapping("VorigeWeek", DataPointMember.YValue));
smartHomeChart.SeriesMappings.Add(sm);
smartHomeChart.DefaultView.ChartLegendPosition = Dock.Bottom;
}
my sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XValue));
Should Show GAS for no.1 and Electricity for no.2
But i cant get it working? im sending u a picture in the picture u can see that the first number is gas and the value for this week and last week and same for number two. I want to change the names to GAS and Electricity
public void GenerateChart()
{
SeriesMapping sm = new SeriesMapping();
sm.LegendLabel = "Comparrison of the Past 7 days, with the folowoing 7 days (€)";
smartHomeChart.DefaultView.ChartTitle.Content = "Comparison Chart";
smartHomeChart.DefaultView.ChartLegend.UseAutoGeneratedItems = false;
ChartLegendItem item1 = new ChartLegendItem();
item1.Label = "Previous week";
item1.MarkerFill = new SolidColorBrush(Colors.LightSkyBlue);
smartHomeChart.DefaultView.ChartLegend.Items.Add(item1);
ChartLegendItem item2 = new ChartLegendItem();
item2.Label = "This week";
item2.MarkerFill = new SolidColorBrush(Colors.PaleVioletRed);
smartHomeChart.DefaultView.ChartLegend.Items.Add(item2);
smartHomeChart.DefaultView.ChartArea.AxisX.IsDateTime = true;
smartHomeChart.DefaultView.ChartArea.AxisX.AutoRange = false;
smartHomeChart.DefaultView.ChartArea.AxisX.MinValue = 40839.00;
smartHomeChart.DefaultView.ChartArea.AxisX.MaxValue = 40845.00;
smartHomeChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
smartHomeChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";
sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XValue));
sm.ItemMappings.Add(new ItemMapping("DezeWeek", DataPointMember.YValue));
sm.ItemMappings.Add(new ItemMapping("VorigeWeek", DataPointMember.YValue));
smartHomeChart.SeriesMappings.Add(sm);
smartHomeChart.DefaultView.ChartLegendPosition = Dock.Bottom;
}