0
Under review

Rectangle Bar Series Export PDF Bug

Jaloko 8 years ago updated by Oystein Bjorke 8 years ago 1
When using the default example rectangle bar series code. If you zoom or pan in the graph and then export it to a PDF the output is this:
Image 22

As you can see the bars render outside of the plot area. Was going to create an issue on github but wanted to check first that I'm not doing anything wrong.

Here is the codebase that can reproduce this:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// Assign Plot Model
plotView1.Model = RectangleBarSeries();
}

public static PlotModel RectangleBarSeries()
{
var plotModel1 = new PlotModel();
plotModel1.LegendPlacement = LegendPlacement.Outside;
plotModel1.Title = "RectangleBarSeries";
var linearAxis1 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
plotModel1.Axes.Add(linearAxis1);
var linearAxis2 = new LinearAxis();
plotModel1.Axes.Add(linearAxis2);
var rectangleBarSeries1 = new RectangleBarSeries();
rectangleBarSeries1.Title = "RectangleBarSeries 1";
rectangleBarSeries1.Items.Add(new RectangleBarItem(2, 1, 8, 4));
rectangleBarSeries1.Items.Add(new RectangleBarItem(6, 6, 12, 7));
plotModel1.Series.Add(rectangleBarSeries1);
var rectangleBarSeries2 = new RectangleBarSeries();
rectangleBarSeries2.Title = "RectangleBarSeries 2";
rectangleBarSeries2.Items.Add(new RectangleBarItem(2, -4, 8, -1));
rectangleBarSeries2.Items.Add(new RectangleBarItem(6, -7, 12, -6));
plotModel1.Series.Add(rectangleBarSeries2);
return plotModel1;
}

private void button1_Click(object sender, EventArgs e)
{
// Export PDF
Graphics g = this.CreateGraphics();
float dx = g.DpiX;
float dy = g.DpiY;
using (var stream = File.Create("C:\\test.pdf"))
{
PdfExporter.Export(plotView1.Model, stream, (plotView1.Width * 72 / dx), (plotView1.Height * 72 / dy));
}
}
}

Under review

I guess the problem is that clipping is not implemented in pdf!

I think it is covered by

https://github.com/oxyplot/oxyplot/issues/85