iOS CoreText Slowing Down Plot Render on First Draw?
benhysell wrote at 2014-03-10 18:24:
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:
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:
benhysell wrote at 2014-03-20 02:09:
public override OxySize MeasureText (string text, string fontFamily, double fontSize, double fontWeight)
specificallyvar 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:
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:
Nice work!
benhysell wrote at 2014-04-05 16:37:
how to export oxyplot charts to power point slides ?
LineSeries Delete LineJoin/Edge
kikomachine0817 wrote at 2013-11-05 13:25:
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
jfraschilla wrote at 2013-08-20 19:39:
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:
Dirk
objo wrote at 2013-08-22 21:25:
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:
ElToTo wrote at 2013-09-07 21:00:
Make sure that you have the OxyPlot.dll assembly in the same assembly as the OxyPlot.WindowsForms.dll.I don't understand how you do that! Please give more details.
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)...
Thx.
Resize rectanglebar item in RectangleBarSeries
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?
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)
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).
OxyPlot : integration in website/webservice
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,
Series Axis
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
sharethl wrote at 2014-03-04 14:27:
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.
Customer support service by UserEcho