I'm using the DataVisualizations Charting control on a .NET Windows form project. The problem I'm having is that when I print the chart the legend is not showing the series marker (actually it is kind of showing but it just looks like a darker pixel on the line). When the chart is viewed on the form the markers are visible although they are not very large and do not seem to change in relation to the MarkerSize value for the series. But when the chart is printed (on paper or to a PDF) the markers are not there.
This picture shows the view of the chart when viewed on the form. As you can see the legend markers are sort of visible but still no where near what the actual series markers are.
This image shows a PDF version of the same chart. If you squint real hard you can see darker pixel in the center of the legend line.
How can I fix the legend markers so they actually show when printed and to make them larger in size?
Since there seems to be no way to control the Legend Markers you may need to create a custom Legend. Here is an example of how it may look in the
Form
and in aPDF
:I had to zoom out the PDF, so it looks a little thinner/lighter.
Here is a function that returns a
CustomLegend
:Here is how I call it:
A few notes:
chart.ApplyPaletteColors()
. This is necessary to access theSeries
color.NamedImage
andChart.Images
. This is neccessary since setting any images in aChart
requires a string!LegendCells
. For an example see here!ChartType
(Line
) and only twoMarkerStyles
.CustomItems
. See here for more info..Series.MarkerSize
but it is easy to adapt the code by settingir = S.MarkerSize;
etc inside the loop!Font
..