A forum dedicated to WPF version of LightningChart Ultimate.
- Posts: 6
- Joined: Wed May 13, 2020 3:48 pm
Can you please tell me what can be the best way to grab a Polar plot I have in my interface with no background colors (on the chart itself as well on the polar area= Completely transparent "white?") so it become Printer friendly when chart goes from the App to Paper.
This was the best I was able to do (still gradient in the polar, and gray in the background).
This is my current code:
I'm storing the original background before copying to the clipboard, then restoring them back.
Code: Select all
Color u = _PolarPlotHelper.PolarChart.ChartBackground.Color;
double OP = _PolarPlotHelper.PolarChart.Background.Opacity;
_PolarPlotHelper.PolarChart.ChartBackground.Color = Color.FromArgb(0, 0, 0, 0);
_PolarPlotHelper.PolarChart.Background.Opacity = 0;// Color.FromArgb(0, 0, 0, 0);
_PolarPlotHelper.PolarChart.ChartBackground.Color = u;
_PolarPlotHelper.PolarChart.Background.Opacity = OP;// Color.FromArgb(0, 0, 0, 0);
Your help will be appreciated.
- Posts: 83
- Joined: Wed Mar 27, 2019 1:05 pm
As you mentioned, there is still some gradient in the polar chart. You can disable this as well by setting GradientFill to solid. Also use ChartBackground to change the color of the view background and GraphBackground to change the color of the graph (circular area). Furthermore, modifying Opacity might not have any effect in some cases.
Here is a simple example where background properties are changed when the chart is double-clicked.
Code: Select all
_chart.MouseDoubleClick += _chart_MouseDoubleClick;
private void _chart_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
_chart.ViewPolar.GraphBackground.Color = Color.FromArgb(0, 0, 0, 0);
_chart.ViewPolar.GraphBackground.GradientFill = GradientFill.Solid;
_chart.ChartBackground.Color = Color.FromArgb(0, 0, 0, 0);
_chart.ChartBackground.GradientFill = GradientFill.Solid;
_chart.Background.Opacity = 0; // Might not be necessary
// Change the background back if needed
Note that it could be a good idea to call CopyToClipboard (or other similar method like SaveToFile) after the chart has been updated i.e. chart.EndUpdate() has been called. This is to make sure that all of those color changes are actually done when taking/printing the chart image.
Hope this helps.