jeudi 26 février 2015

Labels in 3D WinForms-Barchart are not shown if all y-values are 0

is there any possibility to show datapoint-labels in 3D-Barcharts even if the value of all DataPoints is 0? Adding a single DataPoint that has a Y-Value > 0 forces all points to show their labels but what if I just have no y-values? This works for 2D charts but not in 3D.


My code is



private String[] _captions = new string[]
{
"aaaaaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"aaa aaa a aaa a a aaaaaaaaaaaaaaa aaaaa",
"aaaaaaaaaaaaaaaaaaaaa"
};

public Form1()
{
InitializeComponent();
chart1.Series.Clear();

// Ensure that chart is shown 3D (the labels are always shown in 2D)
chart1.ChartAreas[0].Area3DStyle.Enable3D = true;

Series series = new Series();
series.ChartType = SeriesChartType.Bar;

// I want every value to be displayed
chart1.ChartAreas[0].AxisX.Interval = 1;

// Fill the series
DataPoint dp;
for (int i = 0; i < 20; i++)
{
dp = new DataPoint(i, 0);
dp.AxisLabel = _captions[i % _captions.Length];
dp.IsValueShownAsLabel = true;
series.Points.Add(dp);
}

// Add the series
chart1.Series.Add(series);
}


Best regards!


Aucun commentaire:

Enregistrer un commentaire