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

WPF Scatter Series broken again in 263af359f2ef

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

seveland12 wrote at 2012-05-10 22:06:

Same issue as before, where the overlaid points are invisible.


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

thanks for the notice! I see I lost the bug fix when I pulled in some changes and merged to quickly from a fork that had not updated the latest changes. I have re-submitted the fix now.

CategoryAxis Exception Thrown

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

bsguedes wrote at 2012-04-18 17:16:

Hello,

First of all congratulations for the excellent library! I searched a lot for WPF good charting libraries and I have finally found one!

I'm having an issue trying to plot the BarSeries example. The following exception is thrown: "The y-axis should be a CategoryAxis."

I don't know if I have got it right, but isn't the X axis supposed to be a Category axis? The y-axis would be a linear axis showing the values of each bar for each label, am I right?

Thanks for any help!

Bruno

 

EDIT: ok, when I run the project BarSeriesDemo it works... I don't understand why we have to set DataContext = this in that example (as it won't work without that line). Could I plot a bar graph the same way I plot a Line graph, i.e., something like this:

var plot = new PlotModel();
// create axes...etc...
var lineSeries = new LineSeries(myLabel);
// fills lineSeries with my Data
plot.Series.Add(lineSeries);
myGrid.Children.Add(new OxyPlot.Wpf.Plot { Model = plot };


objo wrote at 2012-04-18 21:01:

The BarSeries is horizontal, the ColumnSeries is vertical.

I will improve the exception message to give more information about this.

It is also important to fill the category labels (the Labels list property, or an ItemsSource and a LabelField) with the same number of items as in the bar/column series. 

More documentation on this is coming later as soon as I get time. See the examples.

You need to set the DataContext in order for the binding to the plot model to work (this is standard wpf).


bsguedes wrote at 2012-04-18 21:17:

Thanks for the quick answer! ColumnSeries works fine for me!

Proposal for modified layering

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

ffiala wrote at 2012-03-08 22:50:

I am very impressed of how easy an implementation of oxyplot is possible.

Many of my plots use a DateTime axis and I am used to change a monolor background to a background wth colored areas which represent the months for example (see the following example).

To implement this I created a new Annotation class "FreeAnnotation" and added two methods in order to be able to draw rectangles an text. This works fine but the annotation can only be added as "BelowSeries" oder "AboveSeries". So when drawing a rectangle as a BelowSerie then a grid ist hidden because it is drawn before the annotation.

So I changed the drawing order in "PlotModel.Rendering.cs from

this.RenderBackgrounds(rc);           
this.RenderAxes(rc, AxisLayer.BelowSeries);            
this.RenderAnnotations(rc, AnnotationLayer.BelowSeries);            
this.RenderSeries(rc);

to

this.RenderBackgrounds(rc);           
this.RenderAnnotations(rc, AnnotationLayer.BelowSeries);            
this.RenderAxes(rc, AxisLayer.BelowSeries);            
this.RenderSeries(rc);

But this is not a good solution because it has to be done with each new release.

My proposal is

  • to change the drawing sequence of the two layers (RenderAnnotations(rc, AnnotationLayer.BelowSeries) and RenderAxes(rc, AxisLayer.BelowSeries) or
  • to add additional postitions of the annotation layer (like "BelowAxes" or "AsBackGround" or "AboveBackGround") or
  • to to add something like a "zIndex" whose initial values represent the order of the respective layer but it is a value which can be changed by program.

objo wrote at 2012-03-09 08:20:

I suggest we add "BelowAxes" to the AnnotationLayer enum and change to

this.RenderBackgrounds(rc);           
this.RenderAnnotations(rc, AnnotationLayer.BelowAxes);            
this.RenderAxes(rc, AxisLayer.BelowSeries);            
this.RenderAnnotations(rc, AnnotationLayer.BelowSeries);            
this.RenderSeries(rc);

This should not change the behaviour for existing plots


objo wrote at 2012-03-12 06:30:

I added "BelowAxis" to the AnnotationLayer enumeration. Included an example in the AnnotationExamples in the ExampleLibrary/ExampleBrowser.


ChevyCP wrote at 2012-03-27 17:55:

ffiala, I'm doing a similar thing myself.   Could you please share your "freeannotation" class?

0
Under review

How to i use geoetry

김덕호 10 years ago updated by Oystein Bjorke 10 years ago 1
How to i use path(geometry) in Annoation?

ImageAnnoation is not vector. when i zooming it broken pixel.

so Make geometry using Illustrator. it's 260000 length. it isn't point(ex, f m1 ~~ z)

I want use this path

please help me...

Rotate title of a LinearAxis

Oystein Bjorke 10 years ago updated by Che 5 years ago 2
This discussion was imported from CodePlex

mreu wrote at 2012-08-22 14:15:

Hi

I am really new to your great OxyPlot.

I have a plot with more than one horizontal axes. Some of them are very small and the titles on the left side are clipped. How can I rotate the titles so that they are horizontal and not vertikal? I did not found how to do this.

Thanks

Michael


objo wrote at 2012-08-23 08:41:

Try the "Angle" property.

Note, there is an un-solved issue http://oxyplot.codeplex.com/workitem/9594-

For vertical axes, I would also like to implement http://oxyplot.codeplex.com/workitem/9972.


mreu wrote at 2012-08-23 09:56:

Hi objo

Thanks for the quick answer, but "Angle" rotate the labels of the ticks not the title or do I miss something?

Thanks

Michael


objo wrote at 2012-08-23 15:41:

Right, "Angle" rotates the labels of the ticks. Rotation of the titles is not yet implemented.

Do you want to rotate the titles of the horizontal (X) axes?

For vertical axes, the following feature is planned http://oxyplot.codeplex.com/workitem/9972.


mreu wrote at 2012-08-23 15:55:

Ho objo

yes, I need to rotate the titles on the left/right side. I have 9 LinearAxes (which are shown from left to right), some of them only show if it was activated or not. So I need the titles horizontal because they are truncated now.

Thanks

Michael


objo wrote at 2012-08-24 09:16:

ok, I added http://oxyplot.codeplex.com/workitem/9994

Reference line in plotarea

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

Firefox360 wrote at 2013-09-25 14:35:

Hey there,

What i'm supposed to make is a reference line in the plot area where the graphs are shown in.
But when the program draws the line, it draws the line over
the complete oxyplot area. So also under the x-axis.

I wanted to add a picture of it in here, so it would be easier to understand, but it's only possible to add pictures from the internet.

Code:
    private float lijnStartX, lijnEndX;
    private float lijnStartY, lijnEndY;
    lijnStartY  = (float)0;
    lijnEndY    = (float)plotBSITotalA.Height; 

    private void plot_MouseDown(object sender, MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            lijnStartX = e.X;
            lijnEndX = e.X;
            Draw(lijnStartX, lijnEndX, lijnStartY, lijnEndY);
        }
    }

    private void Draw(float startF, float endF, float startY, float endY)
    {
        this.Refresh();

        float startX        = startF;
        float endX          = endF;
        float[] dValue      = { 5, 5 };
        PointF startP       = new PointF(startX, startY);
        PointF endP         = new PointF(endX, endY);
        Graphics g          = plotBSITotalA.CreateGraphics();
        Pen p               = new Pen(Color.Red);
        p.DashPattern       = dValue;

        g.DrawLine(p, startP, endP);
    }

Drag & Drop

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

wolf9s wrote at 2014-06-09 15:55:

First, the compoment is amazing!!!!!
Thank you for your effort.

I have some questions:
  1. I want to implement Drag & Drop operations. But I have no idea.
    I want to Drag LineSeries(by drag the legend) from a PlotView to anthoer, and then the original PlotView was closed.
    should I operate PlotCommands and PlotController?
  2. If I want to add close button in the Yaxis(when a plotview has many LineSerieses), how should I do ?
  3. If many LineSerieses in a plotview, how track the point?
Image Axis with close button.

Image Multi tracker (show always)

Image fake legendImage
Everyone, I need your help!

Best Regards!
Lee

objo wrote at 2014-06-11 12:17:

  1. WPF? I think this must be done using the drag/drop features in WPF, I don't think the PlotController can help you here.
  2. Buttons must be in an overlay, they are not supported in the plot model. See Source\Examples\WPF\WpfExamples\Examples\OverlayDemo
  3. The tracker should work with many LineSeries. The PlotModel has a HitTest method you can use to do hit testing.

wolf9s wrote at 2014-06-15 16:40:

Thank you for your response!!

For Drag & Drop , I user a Rectangle and a TextBlock ( in an overlay) instead of the real Legend. But I can't confirm the position of the fake legend.(The distance between PlotView's Left and the PlotArea's Left, it should be the width of the Y Axes, but I cant't get it).
My idea is wrong?

I try change the left of the fake legned in PlotView's Loaded event and PlotModel's Updated event .But I always get the 0.

But I debug and find in RenderBox (in PlotModel.Rendering.cs file) method,the PlotArea's value is not 0.

wolf9s wrote at 2014-07-01 03:30:

Help me, please!

objo wrote at 2014-07-02 12:47:

Sorry, I don't understand the problem here. Can anyone help?

wolf9s wrote at 2014-07-23 18:08:

I don't know why the image can't display! but you can click the link to look at it.
Can These images help understand my ideas?

Slxe wrote at 2014-07-24 15:18:

Using imgur.com instead of SkyDrive might help, but anyway this sounds like something that is out of scope for OxyPlot to provide, as drag and drop functionality is on the Frame level if I recall correctly.

Just as an idea you could try serializing the Series you click on and saving it outside of the PlotView, and removing it from the PlotModel. Have some kind of fancy draging image on the cursor then when the mouse button is released have the program check for a PlotView where the mouse cursor is, deserialize the Series and add it to this PlotView (I may be over thinking the serialization though, probably could just be an object).

I haven't played with drag and drop functionality since I was working on UIs in Python and Qt, so it's been a while, but hopefully this helps.

custom markers

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

pocketbboy wrote at 2011-11-09 12:33:

Hello . There is a way to add images instead off custom markers ?

Thanks.


objo wrote at 2011-11-09 13:29:

sorry, no support for images (yet). (need to find a good pattern to solve image loading on the different platforms supported)


isaacd1 wrote at 2012-11-04 13:03:

Hi

I also need this feature

 

Any date when it will be release ?

 

Isaac Dagan


objo wrote at 2012-11-04 22:21:

Sorry, I cannot implement this right now.

But this project is open source - feel free to make a fork and propose a solution!

Remove Plot Paddings

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

hamzad_cne wrote at 2014-01-08 10:29:

Hello,

I'm trying to include the Oxyplot Heatmap series as a layer on a map using Silverlight Bing Maps.
I always have a small shift in both directions for added coordinates, and I think it is because of the padding added to the external border of the plot. Is there a way how to remove this padding so the plot area fills all the space ?

Thank you.

objo wrote at 2014-01-08 10:57:

The control template of the Plot control contains a Border:
        <ControlTemplate TargetType="{x:Type local:Plot}">
          <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
            <Grid x:Name="PART_Grid" />
          </Border>
        </ControlTemplate>
Have you tried setting the BorderThickness property to 0?

hamzad_cne wrote at 2014-01-08 12:57:

Thanks for your reply.

I set 'BorderThickness' to 0 but I had the same render.

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

How large is the shift? Can it be a layout rounding problem?

Removing a single point from an OxyPlot Series

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

lhhc wrote at 2013-05-26 19:25:

My question is simple. If you can add a point using OxySeries.Points.Add, is it possible to remove a single point from the series?

objo wrote at 2013-06-08 11:28:

Yes, use the Points.RemoveAt method.
Remember to invalidate/redraw the plot afterwards (the model is not listening to changes in the Points collection).

lhhc wrote at 2013-06-08 21:05:

Thanks, would you mind providing me with an example of the syntax. Is Points.RemoveAt(0) mean that it would remove the last point of the series?

objo wrote at 2013-06-08 22:25:

No, index 0 is the first point, see http://msdn.microsoft.com/en-us/library/5cw9x18z.aspx

lhhc wrote at 2013-06-08 22:31:

Thanks for the fast reply. So I've created a line series called hrseries and a plotmodel called hrtmp. When I call HR=hrtmp, it triggers the RaisePropertyChanged which I confirmed works correctly. Currently I'm clearing the lineseries and adding all the points to the lineseries every time I add a new point, which is slow. So I changed the code to remove one point at index 0 when its longer than 1000 points. Now my graph is empty. Is the code correct?
if (hrseries.Points.Count > 1000)
{
     hrseries.Points.RemoveAt(0);
}
hrseries.Points.Add(new DataPoint(xval, yval));
hrtmp.RefreshPlot(true);
HR = hrtmp;

lhhc wrote at 2013-06-08 23:12:

Actually I found my mistake. Forgot to add:
hrtmp.Series.Add(hrseries);