I am using evaluation version of TeeChart VCL v2012 in Embarcadero C++Builder XE. In my program I get about one thousand of points every second and put them into FastLineSeries. To put points into seraies I use AddXY method. When I run my application, it tooks about 20% of processor time on 3 series. I was wonder if you could give me some advice how to improve performance of adding and drawing series?
I'd suggest you to try to implement as many tips as possible from those explained in the Real-Time Charting article here. Resuming:
Disable/hide some chart elements
Populate series with data. Use arrays and remove unneeded points. See an example in the features demo at "All features\Welcome !\Speed\Fast Dynamic Arrays"
Other tips:
If you are adding many points at a time, try setting AutoRepaint=false before the addition, and back to AutoRepaint=true after it.
Use the TFastLineSeries's DrawAllPoints property. See an example in the features demo at "All features\Welcome !\Speed\Fast Line Speed DrawAll".
Use the TDownSampling function. See an example in the features demo at "All features\Welcome !\Functions\Extended\Reducing number of points".
And also look at the other examples in the features demo under "All features\Welcome !\Speed".
NOTE: The features demo is an application shipped with the installation that shows the majority of features supported by the component.
Related
Using Vaadin's charts (which ultimately uses HighCharts), I'm trying to plot a line graph with over 10,000 points. It actually works reasonably quickly (a couple seconds to plot). However, I wonder if it can be much faster, as I came accross a similar problem when using JavaFx charts and discovered that people have implemented a solution using the "Ramer–Douglas–Peucker algorithm" to reduce the number of datapoints in such a manner that it's basically noticeable to the human eye when its graphed. (Here's the original answer from SO: Performance issue with JavaFX LineChart with 65000 data points).
So, does highcharts already have such built in functionality? If not, does Vaadin? Or, do I need to recreate this logic in Vaadin, which means I ultimately need to find a Java library for the Ramer–Douglas–Peucker algorithm....
Unfortunately, Highcharts doesn't have "Ramer–Douglas–Peucker algorithm" built-in. However, it has a boost module which allows rendering thousands of points in milliseconds.
The Boost module allows certain series types to be rendered by WebGL
instead of the default SVG. This allows hundreds of thousands of data
points to be rendered in milliseconds. In addition to the WebGL
rendering, it saves time by skipping the processing and inspection of
the data wherever possible.
API reference:
https://api.highcharts.com/highcharts/boost
Demo:
https://www.highcharts.com/demo/line-boost
What's more, using Highstock you can use dataGrouping.
Data grouping is the concept of sampling the data values into larger
blocks in order to ease readability and increase performance of the
JavaScript charts.
API reference:
https://api.highcharts.com/highstock/series.line.dataGrouping
Demo:
https://www.highcharts.com/stock/demo/data-grouping
With most of the chart types when you ise Vaadin charts it actually makes more sense to apply algorithm to reduce number of data points in your server side logic, e.g when copying data from original data dourse to DataSeries you use in the chart. This does not only reduce rendering time, but time to load the data to browser as well.
I would also recommend to calculate linear regression as additional two point DataSeries on server side if such thing is needed.
Does it happen that no one ever needs histogram in Delphi ?
Google gave me a bunch of half-baked code snippets. But it means that each time you need one - you have to invent one more ad hoc bycicle.
Torry mostly told me about some very expensive closed source Math Statistics or Financial packages, that as a subproduct have histograms. But they are very expensive and since you have no source code, each time you install update onto IDE/RTL/VCL you're probably screwed, until the vendor would make (soon ? ever?) updated packages. Given thatvendor is still does exists.
S.O. told me nothing, nil.
For what i found...
Mitov.com provides some histograms in PlotLab. which told to be free for non-commercial. Alas, it is again closed-source, and if the Histogram - quite fancy let's admit -is the onlything i need from it - why pay the whole price ?
One more example http://DSpatial.sf.net
Just few years ago i used it in Delphi 5, but even then i felt the author is loosing interest in the project. I made few enhancement, fixed some bugs, he merged them and that's all. The component was not very useful and lacked upon features, yet better than nothing. Now the project seems to be completely dead. Good old days, etc. But i do not want them back :-)
And Stack Overflow seemingly carries no single question about it. But maybe just no one bothered to create topic, after search found nothing ? I mean, Delphi was created for database access, histograms are one of basic ways to visualize data, and no one crosses them ? Something with nice style, with rich mouse tooltip like in HTML/CSS/JS on http://www.moskva.fm/stations/FM_95.2 ?
Or is this too domain-related and not ever possible to have good abstraction ?
TChart is a control that ships with most versions of Delphi. TChart can be used to make histograms (bar charts) in style. The following give you some ideas about how to use it: http://www.digitalcoding.com/tutorials/delphi/Simple-steps-to-create-Delphi-chart.html and http://delphi.about.com/od/adptips2006/qt/chart_selectbar.htm .
If you need something with code, google the pages at delphiforfun.org/programs/oscilloscope.htm . These are not controls. The oscilloscope article has a histogram with source. Some of the other projects at the site have other histogram graphs with source..not elegant but useful and free. Use them as a template to make your own control.
The link at http://delphiforfun.org/programs/Math_Topics/probability_distributions.htm shows how to make your own statistics displays with "histograms." This example makes use of TChart.
Here is some more stuff to try I found looking at my resource file:
http://wiki.lazarus.freepascal.org/TAChart, http://members.home.nl/mvanwesten/en_lazarus.html , http://www.martinole.org/TAChart.html ...some of these are GPU components that supposedly work with some versions of Delphi. Perhaps this is your lucky day as there is some source code. The first and third listed probably will work reasonably for histograms. You may have to write your own statistics algorithms.
Found this thread while doing some searching. The ImageEn component suite has a THistogramBox component. It's the NOT prettiest thing in the world, but it's the only one I've found so far.
http://www.imageen.com
I came across a histogram example in a gdiplus package available for download from code central. I don't know if it will do what you need but when I saw it I remembered your SO question.
HTH.
If you were using firemonkey, you could just created a series of TRectangles in series. They can be made unclickable by turning hittest off. Or is that too easy and straightforward?
I need a control to add data trending to my application. Is anything available or do I need to use a graphing control and add my own trending features?
Trending is typically an included feature in 3rd party charting components (at least the ones i've seen) but it might be called something else such as linear regression or possiblly something like "least squares*." You should definitely not need to roll your own, unless you think it would be fun. ;-)
Google-ing for "Delphi Chart Regression" will turn up some interesting links.
(* Least squares is typically the method used to establish a trend line from a data set.)
In your shoes, I'd use the stats and charting tools from http://www.lohninger.com/delfcomp.html. It may be a bit more low-level than you want, but I've been very happy with this guys tools (which are reasonably priced, IMO, and, as I recall, can be downloaded for free on a trial basis...)
Check out the curvefit example (comes with an exe demo so no compiling or installing is necessary) here: http://www.lohninger.com/examples_part1.html It'll show you the kinds of charting as well as curve fitting. It's very instructive.
Try JvChart from the JEDI JVCL. If you don't like it, let me know, because I wrote most of it, and I always like to know what people think. It can do static and scrolling displays, and it is very easy to add a few lines and plot some data. A demo app is included in the JVCL\examples\JvChart folder.
There is also TJvSimScope, which is like an oscilloscope and is optimal for fast-scrolling charts showing data which changes on a per-second basis.
JVCL is open source and free
Look for TChart component on your component palette. If your Delphi version has it, then look for demo that uses it.
What's the best way to draw shapes interactively at run time using Delphi? I need to be able to select, drag and resize the shapes. This will be used to mark up existing images and documents.
This looks like a good starting point, but I'm wondering if there's a more complete library (preferably free) available that will save some time.
Update:
If you're going with a custom solution from scratch, I've seen another example on Delphi Central that might be an even better starting point.
I will recommend you, read some links on my site. Are explained and all the source code is available; You can see and get some usefull for you.
Plugin system in Delphi - Part 2
Not directly what you need, is a plugin system for Delphi. But all the samples are based on a drawing tool that uses Shapes (Creating, selecting, resizing). You can review the code and extract what you need.
Sample manipulating of "Maps and Figures"
Sample of how to create, select and move components at runtime (in this case with TImage).
- Select shapes visually: Shows different ways to select shapes visually.
The web is in Spanish, but you can generate an authomatic translation on the web itself.
Anyway the code is commented.
Regards.
Excuse-me for my bad english.
One freeware option would be TssControlSizer. Just change the "control" property to the control you want to manipulate resize/move.
Not sure if you've moved on now with this Bruce but if you haven't, it might be worth looking at TMS Components Diagram Studio - it's certainly cheap, and looks quite powerful from the demo.
I would use Flex Graphics (commercial, $499 for one developer, with sources, $1500 for site-license, with source code). When I bought it, it was a lot less than that. So I guess, I wouldn't pay that now. It's a lightweight 'drawing/cad' package.
But as I already own it, I could import a page from the original document as an image, perhaps rendered in PNG or WMF, and then mark it up with lines, etc.
You could think of it as a light "cad" package. It has most primitive shapes, and you can easily create your own new objects or shapes in Delphi classes, that could be "smart shapes" like the ones in Visio.
http://www.flex-graphics.com/
Another commercial component set that I have heard only good things about is TRichView. They have a TRichViewEdit that looks like you could emulate a document markup environment easily with it.
Please check here:
TCAD -2d graphics component for delphi
http://www.codeidea.com
wish can help you.
I am looking for a rails flash graph/chart plugin, for drawing
bar chart,
stacked bar chart,
pie chart,
stacked area chart,
and line graphs
which support the below criteria,
1. Customizable tool tip. For eg: when i am drawing a stacked area graph, i want to display all the y axix values for that x axis point as tool tip.
2. Graph should support on click event
3. The graph should be able to send as an image through inline attachment.
4. Column graph, that should be able to display the value above the bar.
5. Should be able to turn off the animation
6. We can draw two y axis
Any help is highly appreciated.
Thanks in advance.
Nithy"
EDIT: I am willing to purchase a commercial license if its servers the purpose.
I don't know which ones will have all the features that you want but I was playing with charts a while ago and this is a list of some possibilities:
Ziya(http://ziya.liquidrail.com/) - Rails plugin
AmCharts (http://www.amcharts.com/) - The one I ended up using because of flexibility - No rails plugin but it is quite simple to deploy using with rails XML support (I guess it does export images and has all the features you want though it might take a little while to understand and make full use of it)
Fusion Charts (http://www.fusioncharts.com/) - Seems to be a good option if you are willing to inve$t some money on it
Gruff (http://nubyonrails.com/pages/gruff) - Also rails plugin - I don't remember anymore why I decided against it but I think it was because of the lack of animation
OpenFlash (http://openflashchart.com/) - I liked this one though I just used as a proof of concept
I also did try the Timeplot (http://www.simile-widgets.org/timeplot/) that is totally javascript because I had a problem with the amount of points it was required for my charts and the flash-based solutions had several limitations on that. Though I gave it up because of deployment time contraints.
Hope it helps.
Check out Highcharts http://www.highcharts.com/
Cheers,
I also heavily use AmCharts in conjonction with the Ambling Rails plugin.
If you go this way, know that you will pass time in the AmCharts reference documentation for fine-tuning the parameters of your charts. But it's worthwhile considering the results it give.