This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

PDF report related question

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

ambrein2 wrote at 2014-01-16 04:37:

Hi,

I an new to OxyPlot and had a question regarding creating report. I checked some of the sample code and using that wrote my report generation code, the code creates PDF report file but there are two files created one is filename.pdf and other is filename_Plot1.pdf. Any idea why there are two pdf's created? I just want one report file. I am using following code to generate report from a PlotModel:

private void CreateReport(string fileName)
    {
        string ext = System.IO.Path.GetExtension(fileName);
        ext = ext.ToLower();

        var r = new Report();
        r.Title = "Waveform Report";

        var main = new ReportSection();          

        r.Add(main);

        main.AddPlot(this.Model, string.Empty, this.Plot.ActualWidth, this.Plot.ActualHeight);

        var reportStyle = new ReportStyle();

        using (var w = new PdfReportWriter(fileName))
        {
            w.WriteReport(r, reportStyle);
        }
    }
Any help is appreciated

everytimer wrote at 2014-01-16 23:02:

I think the additional .pdf is created when you add the model view to the report. I remember having a similar problem, in my case I had to do a lot of screens, and that generated a lot of files. I had to remove them, in the same method, near the end. Good luck

objo wrote at 2014-01-17 07:49:

I think this was a limitation in MigraDoc - images could only be added to a Paragraph by filename, not stream...

Cannot Build Samples in VS2012

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

Destinaxe wrote at 2013-10-03 03:20:

Hello All,

I am trying to build one of the sample WPF applications in VS2012, .NET 4.5 and when I try to build it I get the following errors.

"The Tag Plot does not exist in the xml namespace"

I am also getting errors when trying to build the OxyPlot solutuion in the source folder as well.

Can someone help me with the steps to use these libraries? I am very confused at this point.

Has anyone else had any issue with this or am I doing something wrong? I downloaded the source code and I am trying o open one of the sample WPF projects, is there something more that I need to do?

Thanks!

TavisHall wrote at 2014-01-10 01:49:

Hello,

I have had the very same problem. The error description I get is:

"The tag 'Plot' does not exist in XML namespace 'clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf'

I can see the example correctly in the preview window, but am not able to build it because of this error. Any help would be greatly appreciated!

Thank you

Edit: Note that I am using VS2010 C# Express version.

objo wrote at 2014-01-10 09:30:

I don't think VS Express supports building the Portable class libraries.
Standard Visual Studio should work, make sure you have the latest update installed.

Garreye wrote at 2014-01-31 17:40:

I had this issue when my project target framework was set to .NET 4.0 and the OxyPlot.Wpf dll was for .NET 4.5. This could be the issue.

DateTimeAxis question

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

Gala wrote at 2014-07-02 15:06:

Hi :) I'm working with time series, and i need to display periodical data only for concrete part of day (9am - 18pm) . Are there any way to do this? Thanks.

Gala wrote at 2014-07-03 12:11:

Or maybe you can advice other axeses to solve this problem.

Slxe wrote at 2014-07-03 15:28:

I haven't played with many other axis besides LinearAxis so far, but couldn't you use the TimeSpanAxis or CategoryAxis?

PDF Report: Figures with no caption/Text

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

luisfrossi wrote at 2014-01-29 05:12:

Hello,

Is it possible to remove the captions/Texts from PlotFigures on a PDF Report?

Regards,

Luis

everytimer wrote at 2014-01-29 19:08:

Report report = new Report();
var reportStyle = new ReportStyle();
reportStyle.FigureTextFormatString = "";

objo wrote at 2014-02-02 21:09:

New feature: if FigureText = null, the caption should not be written.

Exporting multiple PlotModels into single pdf

Oystein Bjorke 10 aastat tagasi uuendaja Pavithra K S 8 aastat tagasi 1
This discussion was imported from CodePlex

farezv wrote at 2014-03-06 19:20:

Forgive me if this has been asked before but I couldn't find anything in my searches.

Is there a way to export multiple PlotModels into a single pdf file? Or perhaps export multiple pngs for these PlotModels and then combine them into a pdf?

I've currently implemented multiple pdf and png exports but they all print individually and I would like to display a single pdf on the front end.

Thank you!

P.S. OxyPlot is incredible =D

objo wrote at 2014-03-06 20:49:

To support this, I think PlotModel.Render should be changed to accept a rectangle instead of width&height. Then create a PdfExporter.Export overload that takes a destination rectangle. The alternative can be to set a transform on the pdf rendering context, but I think it is better to change the PlotModel.Render method. I have created https://oxyplot.codeplex.com/workitem/10149

How to calculate the screen length of two points?

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

buaashuai wrote at 2014-07-18 11:02:

Help me! I am using WindowsForms. My xAxis is DateTimeAxis, and yAxis is LinearAxis. I have two DataPoint, A and B, I want to calculate the screen length of A and B. In what way can i accomplish this? Thanks.! Image
My problem is like this. http://pan.baidu.com/s/1nt8yEwh

Slxe wrote at 2014-07-18 16:11:

This method in Axis will probably help:
xAxis.Transform(double x, double y, Axis yAxis);

Bitmap picture in background of Oxyplot Plots in vb.net

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

lparis77 wrote at 2014-03-02 11:07:

Hello,

First of all, thank you a lot for the continous development of that amazing Library !

One feature I would like to implement in my application is to put bitmap picture (from a file)
in background of my graphes.
I know it is possible (I had a look at the examples) through annotations but I have difficulties
to do it in VB.net since there is mismatch between Images classes and OxyImage classes.
I'm looking to have a command such as
"Annotation.imageSource.FromFile(Path ...)" but I have difficulties to handle "Stream classes" as input to OxyImage.

I will appreciate if anyone has some example how to put external files as input to OxyImage.

Regards.

maddog56 wrote at 2014-03-03 02:25:

This may help you get most of the way there. I'm not sure about the interpolate property seen below however. I'm still playing with this myself. Note that the bitmap picture I am referencing is included in my project as an embedded resource in lieu of a file/path reference.

Dim m_AssInfo As System.Reflection.Assembly
m_AssInfo = System.Reflection.Assembly.GetExecutingAssembly
Dim ms As Stream = m_AssInfo.GetManifestResourceStream("Test4Tools.purple-top-white-bottom.png")

Dim image0 As OxyImage
image0 = New OxyImage(ms)
ms.Close()

Dim ianno As New ImageAnnotation
ianno.ImageSource = image0
ianno.Opacity = 0.2
ianno.X = New PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea)
ianno.Y = New PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea)
ianno.Width = New PlotLength(1, PlotLengthUnit.RelativeToPlotArea)
ianno.Height = New PlotLength(1, PlotLengthUnit.RelativeToPlotArea)
ianno.Layer = AnnotationLayer.BelowSeries

ianno.HorizontalAlignment = OxyPlot.HorizontalAlignment.Center
ianno.VerticalAlignment = VerticalAlignment.Middle
ianno.Interpolate = True
myModel.Annotations.Add(ianno)

lparis77 wrote at 2014-03-03 19:51:

Thank you very much.
I began to test this approach from the example source on the codeplex website (Source code section) but
do not spend enough time to success. I will try again but it is not straigthforward if I want to change the picture during
execution.
Regards.

Is the expander messing me up here?

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

WannaInfo wrote at 2014-05-23 12:58:

I have to admit I'm a wpf,c# and oxyplot newbee -

When my application Starts up I don't want a visible Chart as there's nothing that's been processed. I thought I can "hide" the Chart in an Expander - (simple minded, perhaps). The following code appears to break OxyPlot? I expect at Minimum to see the Title - but I end up not seeing anything. Without the Expander I do see the Chart with Title.
<StackPanel Grid.Row="0" Grid.Column="4" Orientation="Horizontal">
   <Expander ExpandDirection="Right">
      <oxy:Plot Grid.Row="0" Grid.Column="4" Title="Plot"
         x:Name="ChartPlot" Title="Ein Grafik" 
         Model="{Binding PlotModel}">
      </oxy:Plot>
   </Expander>
</StackPanel>
What don't I understand about either the Expander or the OxyPlot control? Or perhaps there are "better practices" to hide Content until it's ready for viewing?

Thanks.

XKCD-style graphs

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

TobiasTPCS wrote at 2014-04-15 10:23:

Hello,

How hard would it be to implement 'xkcd style' linestyles? I see no current 'style' setting I could enhance with such a styling.

for people that don't know what I mean: http://xkcdgraphs.com

Image
Image

These plots are very useful to show estimate data instead of hard, absolute data.

I'm curious for your insights :-)

Tnx,

Tobias

objo wrote at 2014-04-15 10:35:

Hi Tobias, I really like this idea :-) It would be great for an example. And could be considered to include in the OxyPlot core. We need to create a custom "HandDrawnLinearAxis" and "HandDrawnLineSeries" using some "hand-draw" interpolation function.

See
http://jakevdp.github.io/blog/2012/10/07/xkcd-style-plots-in-matplotlib/
http://xkcdgraphs.com/xkcd.js

objo wrote at 2014-04-16 07:56:

I think there is a better way... I made the Render method of the PlotModel virtual. Now you can make an XKCD IRenderContext decorator and use this in the overridden render method. This means all content of the plot model can be XKCD style! :-) If someone can write the rand_func (see link) in c#, I can make the decorator! :) http://nbviewer.ipython.org/gist/anonymous/3835181

TobiasTPCS wrote at 2014-04-16 09:07:

Sounds good! I'll see if I can help tonight.

objo wrote at 2014-04-16 23:26:

The decorator is checked in. I just added some random jitter that doesn't look good. Please help on a xkcd filter function similar to the one used in mathematica/matplotlib!
Tip: install the Humor-Sans.ttf font (easily found by google).

Mouse Event on TextAnnoation

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

raphay wrote at 2013-04-19 13:25:

Hi,

I am using Mouse Event in WPF on different types of annotation, I have no problem to handle event on the LineAnnotations and ArrowAnnotations, but i don't succeed in handling event on TextAnnotation, the mouse down event is never called in my application. Is there a property to activate ?

Thank you for your answers.

objo wrote at 2013-04-19 15:07:

I just added a simple HitTest implementation for the TextAnnotation, try the latest version.
The implementation use a point-in-polygon test, it should be possible to improve performance by using a point-in-rectangle test (but this means rotation and alignment must be considered...)