में एक्स-अक्ष में केवल कस्टम लेबल का उपयोग करें, मैं सप्ताहों के एक्स-अक्ष अंतराल के साथ सी # में .NET रेखा ग्राफ बना रहा हूं। मेरी परियोजना के लिए, मैं केवल कस्टम लेबल का उपयोग करना चाहता हूं, लेकिन अभी भी मैं अभी भी ग्रिडलाइन चाहता हूं। क्या कस्टम कस्टम लेबल रखते हुए डिफ़ॉल्ट एक्स-एक्सिस लेबल को छिपाने का कोई तरीका जानता है?.NET चार्ट
मैं इस कोशिश की:
Chart4.ChartAreas[0].AxisX.LabelStyle.Enabled = false;
स्पष्ट परिणाम लागू किया है, जो नहीं है कि मैं क्या करने की कोशिश कर रहा था कोई लेबल नहीं थे कि है।
संपादित करें: मूल पंक्तियों पैदा करने के लिए कोड इस था:
int month = XValues[0].Month;
var XAxis = Chart4.ChartAreas[0].AxisX;
DateTime StartMonthPos = XValues[0];
DateTime EndPos = new DateTime();
foreach (DateTime Date in XValues)
{
EndPos = Date;
if (Date.Month != month)
{
Chart4.ChartAreas[0].AxisX.CustomLabels.Add(StartMonthPos.ToOADate(), EndPos.ToOADate(), StartMonthPos.ToString("MMMM"), 1, LabelMarkStyle.None);
StartMonthPos = Date;
}
month = Date.Month;
}
XAxis.CustomLabels.Add(StartMonthPos.ToOADate(), EndPos.ToOADate(), StartMonthPos.ToString("MMMM"), 1, LabelMarkStyle.None);
चार्ट इस तरह दिखता है:
Chart4.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "M";
और कस्टम लेबल के लिए कोड इस था
और यह इस तरह दिखना चाहिए:
आप कॉलम चार्ट देखना चाहते हैं – Jerome