Dear coders out there,
I'm trying to create a chart with an Y-Axis that consists of ASCII characters (e.g. Hx 41 - A till Hx 46 F) This is used to show grades in a control chart. I've searched multiple websites but (maybe I'm not searching correctly) I cannot find what I'm looking for.
What do I have now:
- My Y-Axis now contains numbering (Hex. 41 till 46)
- My Y-Axis is not formatted yet in any way, only min and max values filled by code below
if (measurementData.Max() >= Usl) maxValue = measurementData.Max();
else if (measurementData.Max() < Usl) maxValue = Usl + 0.1;
if (measurementData.Min() <= Lsl) minValue = measurementData.Min();
else if (measurementData.Min() > Lsl) minValue = Lsl - 0.1;
What do I want:
- My Y-Axis is to show 'A' till 'F' (instead of Hex. 41 till 46)
After looking around a bit more... I found a solution:
Chart1.ChartAreas("ChartArea1").AxisX.CustomLabels.Add(0.5, 1.5, "yr1")
Chart1.ChartAreas("ChartArea1").AxisX.CustomLabels.Add(1.5, 2.5, "yr2")
Chart1.ChartAreas("ChartArea1").AxisX.CustomLabels.Add(2.5, 3.5, "yr3")
Used the example above and modified it to following:
crtProces.ChartAreas[0].AxisY.CustomLabels.Clear();
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(40.5, 41.5, "A");
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(41.5, 42.5, "B");
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(42.5, 43.5, "C");
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(43.5, 44.5, "D");
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(44.5, 45.5, "E");
crtProces.ChartAreas[0].AxisY.CustomLabels.Add(45.5, 46.5, "F");
My next question would be, how can this be made variable? Now the increments are filled in manually (40.5 - 41.5) but how can this be done in a for loop?