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

iOS CoreText Slowing Down Plot Render on First Draw?

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

benhysell wrote at 2014-03-10 18:24:

Just pulled down the latest where CoreText is now being used for the text...everything looks great, but it feels like we lost a good deal of speed while rendering the plots. I have a noticeable lag from launching the application to first render.

Hooking up Instruments, I can dig down and see all of the time is being spent in CoreText inside OxyPlot.

This is noticeable on the simulator, and becomes in your face on the device.

In the example OxyPlot program check out the 'LineSeries' examples. Pick a plot, any plot, and you'll have a bit of a pause, and then the graph draws. After this, pick any other LineSeries and you won't have the lag, and it draws fine. Same thing happens on device and in the simulator. Using Instruments to profile I see the same results, a lot of time spent down in CoreText.

If you kill the application, start it up again, and pick a different plot you'll see the same results, long pause, draw plot, and then any other plot after that will draw fine.

Thoughts?

objo wrote at 2014-03-10 21:24:

Thanks for the report! I did not notice this on my device, but I have only been testing simple examples.
I think we need to avoid disposing CTLine, NSAttributedString and CTFont objects all the time. And maybe the fonts can be cached? I think the UIFont.Fromname call should also be removed.

ps. is the text aligned correctly horizontally? to me it looked a little bit off.

benhysell wrote at 2014-03-10 23:33:

The title text did seem off center by a bit...yes.

benhysell wrote at 2014-03-20 02:09:

I went back to Instruments with my app, it appears most of the time is spent in
public override OxySize MeasureText (string text, string fontFamily, double fontSize, double fontWeight)
specifically
var attributedString = new NSAttributedString (text, new CTStringAttributes {
                ForegroundColorFromContext = true,
                Font = new CTFont (fontFamily, (float)fontSize)
            });
The time killer is the new CTFont (fontFamily, (float)fontSize)

Does anyone have a preferred method for caching the possible different font sizes/font families?

benhysell wrote at 2014-03-20 14:53:

I played around with caching CTFont and did not get the performance benefit I thought I might. After a little more digging I turned up http://stackoverflow.com/questions/6062420/core-text-performance.

tldr
The more attributes a string has the longer it takes to draw.

I've since changed the code to:
var attributedString = new NSAttributedString (text, new CTStringAttributes {
//              ForegroundColorFromContext = true,
//              Font = new CTFont (fontFamily, (float)fontSize)
            });
Commenting out the color and font greatly improves performance, I'd say it is as fast as it was before moving to CoreText.

benhysell wrote at 2014-04-05 16:35:

Latest release has put this issue to bed...plots no longer lag on first draw!

Nice work!

benhysell wrote at 2014-04-05 16:37:

0
Under review

how to export oxyplot charts to power point slides ?

wmacoder 10 jaar geleden bijgewerkt door Oystein Bjorke 10 jaar geleden 1
How can I export oxyplot charts to be exported directly to power point slides ready for presentation ?

LineSeries Delete LineJoin/Edge

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

kikomachine0817 wrote at 2013-11-05 13:25:

Is possible to delete the edge of two vertices?

for example i have 4 points

1 to 2 the line is connected
2 to 3 the line is not connected
3 to 4 the line is connected.

thank you.

Winform Designer Problem

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

jfraschilla wrote at 2013-08-20 19:39:

I am a new user to OxyPlot and tried to create an WinForms example in VS2012 Professional. I followed the steps to add OxyPlot to the VS designer toolbox but I get the following error when I add OxyPlot.WindowForms.dll:

There are no components in 'xxx\OxyPlot.WindowsForms.dll' that can be placed on the toolbox.

John

DIfx wrote at 2013-08-22 13:54:

For me its the same. I'm using Oxyplot in VS 2012 Express and can't insert the plot control for Windows Forms. What should i do?

Dirk

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

Make sure that you have the OxyPlot.dll assembly in the same assembly as the OxyPlot.WindowsForms.dll.

I will try to add OxyPlot.dll to the "OxyPlot WindowsForms" nuget package, but I am not sure if this is a good idea (the OxyPlot.dll assembly is already referenced by the OxyPlot Core nuget package)...

jfraschilla wrote at 2013-08-23 04:22:

That worked, Thanks

ElToTo wrote at 2013-09-07 21:00:

objo wrote:
Make sure that you have the OxyPlot.dll assembly in the same assembly as the OxyPlot.WindowsForms.dll.

I will try to add OxyPlot.dll to the "OxyPlot WindowsForms" nuget package, but I am not sure if this is a good idea (the OxyPlot.dll assembly is already referenced by the OxyPlot Core nuget package)...
I don't understand how you do that! Please give more details.
Thx.

Gap between series in category (columnseries)

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

Devin19 wrote at 2013-10-16 09:42:

By using:
((CategoryAxis)model.Axes[0]).GapWidth = 0.5;
one can set the gapwidth between categories.

But how I'd like to know how one sets a gapwith between series in the same category?

Resize rectanglebar item in RectangleBarSeries

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

mohitvashistha wrote at 2013-01-06 12:28:

I want to re-size the rectangles in RectangleBarSeries. Something like this.

 

I am unable to figure out the approach to proceed.

 

I have created a sample application that enable drag and dropping of rectangular I want to move the element when I click in center of rectangle item (as currently done). And want to re-size by clicking on corners as discussed in the code project link.


objo wrote at 2013-01-12 18:23:

Have you seen the "Mouse events" example in the "Example browser".  You find the source in Source\Examples\ExampleLibrary\Examples\MouseEventExamples.cs.

I think you can use a similar approach to resize the rectangles!


mohitvashistha wrote at 2013-01-17 12:07:

I have implemented the same using a resize behavior


objo wrote at 2013-01-22 10:36:

Great :)

Ps. I was scared away from that 2shared web site. Only found .exe download links...

How to change the cursor to Wait while plotting?

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

jpnavarini wrote at 2012-05-29 00:19:

Hello,

I have to do plots with a large quantities of data (around 300k), and I must have markers in the plot, which makes its drawing VERY slow. Therefore, I need to change the cursor to wait while OxyPlot is drawing my graph. Is it possible?

Thank you!


objo wrote at 2012-05-30 23:00:

The PlotModel class has two events: Updating and Updated. Try to subscribe to these, they are raised before and after the plot is updated (which probably takes most of the time).

I have not added any events before/after the visual tree is updated, but this should be easy to add if needed (in the OxyPlot.Wpf.Plot.UpdateVisuals method).

If drawing is very slow:

  • check that the binding of the data is as efficient as possible (see the performance examples (100k points) in the example browser)
  • if using the scatter series, consider using the "binning" functionality

jpnavarini wrote at 2012-05-30 23:28:

I could not find both of these events> Updating or Updated.

Regarding the drawing speed, it gets slower because I am using ItemsSource to get the data and because I am using markers. Is there a marker that is the fastest or they are all basically the same?

Thank you!


objo wrote at 2012-05-30 23:42:

See OxyPlot.PlotModel.Updating/Updated (you cannot do this from xaml)

See http://oxyplot.codeplex.com/wikipage?title=Performance


jpnavarini wrote at 2012-05-31 16:29:

I still can't find the Updating method in OxyPlot,.PlotModel. The Updated event is OK.

I have been trying to do it in the code behind, not on XAML. I have checked, my OxyPlot library seems to be the latest (v4.0.30319). I don't know exactly what can be wrong.


objo wrote at 2012-05-31 21:11:

That is strange. Are you using the version from the Download page?

I recommend using the Nuget package or build from the latest source, the download is a bit old (I am planning to update this soon - will check the codeplex api if I can automate this part of the process).

0
Beantwoord

OxyPlot : integration in website/webservice

SamOxyPlot 10 jaar geleden bijgewerkt 10 jaar geleden 6
Hi

I was wondering if it’s possible to use OxyPlot for exporting .png files on the fly that are shown in a website.

From what I know I can use it within Winforms / WPF.
But my goal is to have the plotviews available in my website.


We already have an webservice (.NET 4.0). Is it possible to integrate OxyPlot there?
I don’t want a dirty solution to start an external exe in the webpage/webservice that generates the PNG.


Maybe you’ve got an idea?


With kind regards,

0

Series Axis

Mark Bean 9 jaar geleden bijgewerkt 9 jaar geleden 1

After removing and then adding a new series to the model, is there a method or way to force axes to update to reflect the new series' data? At the moment it seems they still reflect the original series' data. Perhaps we missed an essential call?

Custom mouse cursor

Oystein Bjorke 10 jaar geleden 0
This discussion was imported from CodePlex

sharethl wrote at 2014-03-04 14:27:

Great plot! Thanks.

Is there any way to create or extend current mouse cursor without modifying original code?
I have made new classes inherit from plotmodel and wpf plot control.
Need to act like paint, select different annotations, show different mouse cursor before drawing.

Thanks.