Hey,
three screen captures. MyStuff is the way i am seeing my code.
i also wrote a small program to show the differences. There was NO CHANGE IN THE CODE. just the different references.
the code is in the zip file but in case it doesnt take
i am putting the code in the text
xaml
c#
ObservableCollection
coll = new ObservableCollection();
ObservableCollection ForLabels = new ObservableCollection();
public MainWindow()
{
InitializeComponent();
AddDataToSeries();
}
public void AddDataToSeries()
{
Random r1 = new Random();
for (int i = 0; i < 100; i++)
{
coll.Add(new Data() { X = i, Y = r1.Next(0, 100), ProductName =i.ToString() });
}
ForLabels.Add(new Data() { X = 0, Y = 3, ProductName = "Zero" });
ForLabels.Add(new Data() { X = 10, Y = 15, ProductName = "Ten" });
ForLabels.Add(new Data() { X = 20, Y = 20, ProductName = "Twenty" });
ForLabels.Add(new Data() { X = 30, Y = 3, ProductName = "Thirty" });
ForLabels.Add(new Data() { X = 40, Y = 3, ProductName = "Forty" });
ForLabels.Add(new Data() { X = 50, Y = 3, ProductName = "Fifty" });
ForLabels.Add(new Data() { X = 60, Y = 3, ProductName = "Sixty" });
ForLabels.Add(new Data() { X = 70, Y = 3, ProductName = "seventy" });
ForLabels.Add(new Data() { X = 80, Y = 3, ProductName = "Eighty" });
ForLabels.Add(new Data() { X = 90, Y = 3, ProductName = "Ninety" });
Series1.DataSource = coll;
Series1.BindingPathX = "X";
Series1.BindingPathsY = new string[] { "Y" };
chart1.Areas[0].PrimaryAxis.LabelsSource = ForLabels;
chart1.Areas[0].PrimaryAxis.PositionPath = "X";
chart1.Areas[0].PrimaryAxis.ContentPath = "ProductName";
}
}
public class Data
{
public double X { get; set; }
public double Y { get; set; }
public string ProductName { get; set; }
}
Labels_e6413be8.zip