can you tell me what is wrong with my code? I want to generate chart image in console application over System.Windows.Forms.DataVisualization.Charting library... Following code generate me chart only with columns, but I need chart with axis. Any ideas?
Chart chart = new Chart();
chart.Size = new System.Drawing.Size(2000, 500);
ChartArea area = new ChartArea();
chart.BackColor = System.Drawing.Color.Transparent;
chart.ChartAreas.AxisX.MajorGrid.Enabled = false;
chart.ChartAreas.AxisY.MajorGrid.Enabled = false;
chart.ChartAreas.AxisX.Title = "sasdasdasd";
Series series = new Series()
Name = "series2",
IsVisibleInLegend = false,
ChartType = SeriesChartType.Column
foreach (CnbItem item in items)
DataPoint p1 = new DataPoint(0, Double.Parse(item.Kurz));
p1.Color = System.Drawing.Color.LightBlue;
p1.AxisLabel = item.Kod;
p1.LegendText = item.Kod;
p1.Label = item.Kurz;
string filename = "D:\\Chart.png";
Update: Setting the the
Transparent actually works just fine. However some display programs do not display transparency; I use Irfanview as my default viewer and it is one of those which can't. I suspect yours also misses transparency..
Instead all transparency is rendered as Black, so unless you have a non-black line color.. your axes and labels etc.. seem to be gone. Paint (on W10) is another one but renders transparency to white, so the black pixels are visible.
The below image is from Photoshop, which, of course, doesn't have that problem..