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

Linking data series and annotations

concentriq 10 lat temu Ostatnio zmodyfikowane przez anonymous 10 lat temu 5
Hello..  I am trying to place textual information above particular points in the series, and have them be linked, meaning that if I scroll around the plot, the text is always in the same position relative to a particular point in the series. like so:

my lets say length of my int[] data is 15 and it contains values {22, 44, 55, 87, 33, 21, 23, 44, 33, 42, 54, 56, 66, 77, 99}

I need to place letter "H" over position 3, "Z" over position 8, and "T" over position 12. All annotations are near the top of the plot area. My code works fine displaying regular LineSeries but I cant figure out how to add the annotations.  Any help is appreciated


public void SetWaveformData(int[] data)
{
PlotModel plotModel = new PlotModel();
List<DataPoint> dataSeries = new List<DataPoint>();
int i = 0;
foreach (int yValue in data)
{
dataSeries.Add(new DataPoint { X = i++, Y = yValue });
}
LineSeries ser = new LineSeries();
ser.Points.AddRange(dataSeries);
plotModel.Series.Add(ser);
}

Set ItemsSource to a Collection of IDataPoints.

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

willmoore88 wrote at 2013-10-21 17:42:

I have a collection of IDataPoints...
        public Collection<IDataPoint> dataPoints1 = new Collection<IDataPoint>();
I set my ScatterSeries too said Collection.
var lineSeries1 = new ScatterSeries((string)Application.Current.FindResource("cloudLayersText"))
            {
                MarkerFill = CloudDetColour,
                MarkerStroke = CloudDetColour,
                MarkerType = MarkerType.Square,
                MarkerSize = 1.5,
                ItemsSource = dataPoints1,
            };
Why is my graph not showing the data I then subsequently add to my collection of IDataPoints? I know there is data in there as I can see there is over 1400 items in the collection.

willmoore88 wrote at 2013-10-23 11:18:

Anyone?

objo wrote at 2013-10-23 11:23:

Do you refresh/invalidate the plot / plotModel after you have added to the collection? I should add this as FAQ #1 :)

willmoore88 wrote at 2013-10-23 11:26:

I do this after updating the collections.
CloudLayerPlotModel.RefreshPlot(true);
OnPropertyChanged("CloudLayerPlotModel");

willmoore88 wrote at 2013-10-24 09:45:

What else could it be?

Writing PDF report to a FileStream

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

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

Hi All,

I am new to OxyPlot and still getting to know OxyPlot more. I recently was able to create a Plot that contains LineSeries and now I am trying to create a PDF report of this plot. However I don't want to write this report to an actual file, in fact I want to write the PDF report directly to a FileStream. Is there an easier way to do this with OxyPlot library?

objo wrote at 2014-01-16 22:57:

I think this overload should be added to the PdfReportWriter class. MigraDoc supports writing to a Stream.
https://oxyplot.codeplex.com/workitem/10116

ambrein2 wrote at 2014-01-21 01:54:

Thanks for your quick response and also for creating a ticket for writing to a Stream. I had one more question, does OxyPlot support exporting report to TIFF file type? If not is this something easy to do?

objo wrote at 2014-02-02 20:50:

Export to stream is implemented.

Plot not filling parent container (WPF)

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

nsudac wrote at 2013-05-24 11:12:

I'm quite new to both WPF and OxyPlot so please forgive me if I'm missing something obvious. I'm using the DLLs from OxyPlot-NET45-2013.1.35.1.zip.

I have an OxyPlot inside a WPF Viewbox, something like the following:

<Viewbox Name="ViewBig">
<oxy:Plot Model="{Binding CameraGraph}" Name="OxyPlot" />
</Viewbox>

I would like the plot to automatically size to fit the Viewbox, as happens if I put an Image for example in the Viewbox. The problem I am having is that unless I explicitly set the Width and Height of the plot, it remains invisible. I know that the Binding to the model is working correctly as when I do set to the Width and Height explicitly the data is all there.

Am I missing something here?

Thanks in advance for any guidance.

objo wrote at 2013-06-08 12:13:

The plot control will use the available space, so you need to put it inside a container with defined width/height, or you must set the width/height of the plot control.

Vertical Annotations with DateTimeAxis

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

luisfrossi wrote at 2013-06-08 00:47:

Hello,

I would like to add a few like annotations on a Plot with DateTimeAxis... the X value input at an LineAnnotation is a double value. How should i format my DateTime value to the X one?

Regards,

LR

luisfrossi wrote at 2013-06-08 01:03:

Sorry, just realized how.

Just have to use OxyPlot Double conversion.

Thank you!

Great Work here.

objo wrote at 2013-06-08 10:51:

Yes, use DateTimeAxis.ToDouble or DateTimeAxis.CreateDataPoint

PdfSharp/OxyPlot.Pdf version mismatch

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

thomasdr wrote at 2013-10-22 18:50:

When I tried to use OxyPlot.Pdf in a project in which I use PdfSharp, I got this error:

Could not load file or assembly 'PdfSharp, Version=1.31.1789.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

The current PdfSharp version is 1.32.2608.0. The version being using in OxyPlot.Pdf is from 2009. How can I reconcile this? Do I have to build OxyPlot.Pdf from the source code?

objo wrote at 2013-10-22 19:39:

I have changed the reference to the latest version at NuGet (1.32.4334). Is this ok?

thomasdr wrote at 2013-10-22 21:51:

Yep. Compiles now. Thanks.

Logarithmic steps

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

willmoore88 wrote at 2013-08-07 12:11:

Why is the gap between 0-2000 so big?

I have altered the logarithmic scale slightly to only draw major ticks and for them to be at intervals I choose.

https://www.dropbox.com/s/hge7bgbnz9ziz5t/back.png

objo wrote at 2013-08-07 12:47:

What is the ActualMinimum value of your axis? It should not be possible to use 0 on a log axis

willmoore88 wrote at 2013-08-07 12:48:

Ah sorry, it is set to 0 but obviously that is then changed to 0.1 isn't it.

willmoore88 wrote at 2013-08-07 12:49:

It seems to be to do with the Transform function in LogarithmicAxis I think - I can't quite work out what's going on there.

Update Graph After Zoom

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

kurtisharms wrote at 2013-01-29 07:54:

I am drawing functions using my own custom function generator by simply creating a new LineSeries of ~120 points and then plotting that between -10 and 10 to start with using Oxyplot's Windows 8 control. The use of my own custom function rather than a FunctionSeries is necessary because the function input has many variables and other oddities. 

 

What I would like to do is the following:

1) Detect the end of a zooming event and bind an updateGraph() function to this. I cannot find this type of event. The mouse events don't appear to do the trick, as they are either continuous and generate too many events (ie. PointerWheelChanged) or don't work as I expected (ie. ManipulationCompleted). 

2) Having detected the zooming event, updateGraph() updates the graph by creating a new LineSeries from my function that spans the new min to max displayed on the graph. I haven't successfully been able to find the new min/max displayed on the graph.

 

Any help would be greatly appreciated and thank you in advance!


objo wrote at 2013-02-07 22:37:

Can the AxisChanged event help? This will be raised after the axes have been changed (zoom or pan).
The ActualMaximum and ActualMinimum properties of the axes should also be set at this point.

Multiple Panes Axis chart

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

meenakshi07 wrote at 2012-10-15 11:24:

Hi!

I like OxyPlot a lot and I love exploring it. thank you very much for your effort!

I am using Multiple Panes Axis chart in my project.

I have few queries on the same

1. If tracker lines color can be changed ? if yes, how ?

2. whenever I select a point on a lineseries, it shows vertical and Horizontal tracker lines. Is is possible to get trackerformatstring(in tooltip) for other lineseries where the tracker lines intersect them ? if yes, please let me know how we can do it ?

I apologise, if I have asked very basic question, as I am new to WPF itself

Thanks in Advance

Regards,

Meenakshi


objo wrote at 2012-10-16 23:38:

1. It should be possible to set the "DefaultTrackerTemplate" property of the Plot control. The default value is

        <ControlTemplate>
          <local:TrackerControl Position="{Binding Position}" LineExtents="{Binding PlotModel.PlotArea}">
            <local:TrackerControl.Content>
              <TextBlock Text="{Binding}" Margin="7" />
            </local:TrackerControl.Content>
          </local:TrackerControl>
        </ControlTemplate>

See Source\Examples\WPF\WpfExamples\Examples\CustomTrackerDemo

The TrackerControl has properties for "LineStroke", "HorizontalLineVisibility" and "VerticalLineVisibility".

2. It is only tracking one series (finds the nearest when you click down, then follows this series), if you want values from other series you must calculate these yourself (oxyplot has few restrictions on the series and axes => it could be any number of intersections...)


meenakshi07 wrote at 2012-10-17 09:08:

Thanks for your help :)

Multiple X-Axis with Shared Y-Axis

Oystein Bjorke 10 lat temu Ostatnio zmodyfikowane przez Pavithra K S 8 lat temu 1
This discussion was imported from CodePlex

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

I am trying to build a chart with this superb tool as seen in the image. Basically it is 4 line series all with the same y-axis and 4 different x-axis each with varying min/max values. How do I get all series to appear on the chart together as the image shows? I am building the chart ok but some of the series are off to one side or the other and are not visible. I can't seem to "squish" them all on to the same sheet of paper. Thanks.

Image

muzab wrote at 2014-03-04 09:49:

You can use "Multiple Panes" example from the example browser. Even I am trying to do similar thing but mine is multiple(4) y-axis.
I can get a plot on only one x-y1 axis combination but not on the other x-y2,y3,y4.

muzab wrote at 2014-03-04 13:32:

Key (Property) solves the issue. I got it!

maddog56 wrote at 2014-03-04 18:08:

Kind muzab I crown you OxyPlot genius of the month. The Key property is the "key" (no pun intended)! I have achieved my goal finally. If OxyPlot had good documentation it might be the world's best charting software. But I cannot blame Mr. Objo for focusing on the technical enhancements/improvements. Documentation is a necessary evil.