The problem is that when I export the main plot the second plot is not exported as part of the image (emf format). I have set the parent of the second plot to the first plot and it is displayed within the margins of the main plot.
Here is a screen shot showing the original plot within the application: When I export the plot and place it in Word it looks like (notice no color legend): This is the code used to create the second chart:
Code: Select all
m_chartAnotherLegendBox = new LightningChartUltimate(LicenseKeys.LicenseKeyStrings.LightningChartUltimate);
m_chartAnotherLegendBox.BeginUpdate();
//Set chart name
m_chartAnotherLegendBox.Name = "Dummy chart for another legend box";
m_chartAnotherLegendBox.Parent = m_chart; //<----- parent set to main chart
m_chartAnotherLegendBox.Title.Visible = false;
m_chartAnotherLegendBox.ColorTheme = ColorTheme.LightGray;
//Set margins, location and anchor it to top-right corner
m_chartAnotherLegendBox.ViewXY.Margins = new Padding(0, 0, 0, 0);
m_chartAnotherLegendBox.Size = new Size(120, 300);
m_chartAnotherLegendBox.Location = new Point(m_chart.ClientSize.Width - m_chartAnotherLegendBox.Size.Width, m_chart.ViewXY.Margins.Top);
m_chartAnotherLegendBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
//Set graph background fill to transparent, to hide it
m_chartAnotherLegendBox.ViewXY.GraphBackground.Color = Color.Transparent;
m_chartAnotherLegendBox.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
m_chartAnotherLegendBox.ViewXY.GraphBorderColor = Color.Transparent;
m_chartAnotherLegendBox.BorderStyle = BorderStyle.None;
//Hide axis grids
m_chartAnotherLegendBox.ViewXY.XAxes[0].MajorGrid.Visible = false;
m_chartAnotherLegendBox.ViewXY.YAxes[0].MajorGrid.Visible = false;
//Set legend box properties
m_chartAnotherLegendBox.ViewXY.LegendBox.Position = LegendBoxPosition.TopLeft;
m_chartAnotherLegendBox.ViewXY.LegendBox.Offset.SetValues(0, 0);
m_chartAnotherLegendBox.ViewXY.LegendBox.Layout = LegendBoxLayout.Vertical;
m_chartAnotherLegendBox.ViewXY.LegendBox.ShowCheckboxes = false;
m_chartAnotherLegendBox.ViewXY.LegendBox.SeriesTitleFont = new Font(FontFamily.GenericSansSerif, 9.5f, FontStyle.Regular);
IntensityGridSeries dummy = new IntensityGridSeries(m_chartAnotherLegendBox.ViewXY, m_chartAnotherLegendBox.ViewXY.XAxes[0], m_chartAnotherLegendBox.ViewXY.YAxes[0]);
dummy.Visible = false;//<--- if set to true slows down rendering even though no data
dummy.Title.Text = plotdata.colorByAttribute.name;
dummy.Title.ShowInLegendBox = true;
dummy.FullInterpolation = true;
ValueRangePalette colourPalette = CreatePalette(dummy, plotdata.minColorByValue, plotdata.maxColorByValue);
dummy.ValueRangePalette = colourPalette;
m_chartAnotherLegendBox.ViewXY.IntensityGridSeries.Add(dummy);
m_chartAnotherLegendBox.EndUpdate();
Thanks
Greg.