xyscatter with line

xyscatter with line

Forum member · Nov 2, 2021
I'm trying to make a rectangle drawing on top of an xy scatterplot chart based on some plotted points. I thought I could achieve this with using another XYScatterSeries with the rectangle points and using LineDisplay = true, but I cannot get the line to draw. Is there functionality to draw lines/make drawings on a xyscatterplot chart?

Re: xyscatter with line

Support · Nov 2, 2021
Hello, The LineDisplay property draws a line joining the data points. Please make sure that you have the correct data points that represent a rectangle. We are able to display a line without any issue. Please try the below code that draws a rectangle along with another set of data points. // Create a PDF Document Document document = new Document(); // Create a Page and add it to the document Page page = new Page(); document.Pages.Add(page); // Create a chart Chart chart = new Chart(0, 0, 450, 230); // Get the default plot Area from the chart PlotArea plotArea = chart.PrimaryPlotArea; // Create a Header title and add it to the chart Title tTitle = new Title("Sample with line display"); chart.HeaderTitles.Add(tTitle); // Create xyScatter series and add values to it XYScatterSeries xyScatterSeries1 = new XYScatterSeries("Data Without line"); xyScatterSeries1.Values.Add(112, 55); xyScatterSeries1.Values.Add(125, 60); xyScatterSeries1.Values.Add(138, 68); xyScatterSeries1.Values.Add(150, 73); xyScatterSeries1.Values.Add(172, 82); XYScatterSeries xyScatterSeries2 = new XYScatterSeries("Rectangle data"); xyScatterSeries2.Values.Add(100, 30); xyScatterSeries2.Values.Add(100, 50); xyScatterSeries2.Values.Add(60, 50); xyScatterSeries2.Values.Add(60, 30); xyScatterSeries2.Values.Add(100, 30); xyScatterSeries2.LineDisplay = true; // Add xyScatter series to the plot Area plotArea.Series.Add(xyScatterSeries1); plotArea.Series.Add(xyScatterSeries2); // Add the chart to the page page.Elements.Add(chart); // Save the PDF document.Draw("scatter.pdf"); Thanks, ceTe Software Support Team

Re: xyscatter with line

Forum member · Nov 2, 2021
Yes, thank you, I had the y and x mixed up because I rotated the page 90;

Re: xyscatter with line

Support · Nov 3, 2021
Hi, We are glad that you figured it out. Thanks, ceTe Software Support Team