Zooming on Silverlight Toolkit charts? - silverlight

I need to enable zooming on the Silverlight charts I use - at the moment this is Silverlight Toolkit. As far as I've understood the SL Toolkit charts don't support zooming, however I'm looking into implementing this functionality. So far I haven't managed to get far: applying ScaleTransforms to the Series elements doesn't work as expected.
Can anyone provide me with example code on implementing zooming in Silverlight Toolkit?

I've previously looked into implementing zooming on the Silverlight Toolkit charts, however failed because of (probably) the following reasons:
Silverlight Toolkit charts don't seem to have been designed to be able to extend for zooming. There are no hooks that you could easily attack some zooming logic to, if you want to create zooming on them, you have to go much deeer.
The simplest way of implementing zooming is using ScaleTransform and RenderTransform to elements. In case of Silverlight Toolkit you want to apply this to the series. However just calculating the correct ScaleTransform and OffsetTransform are difficult enough
When scaling, you don't want everything to scale. If you zoom in 4x on a line series with points on it, you don't want the line to be 4x thicker and the points to be 4x larger. This means that even if you did implement applying the ScaleTransforms and RenderTransforms correctly, all you would get is a magnifying glass, which is still far from ideal.
After a few hours I gave up on adding this kind of support to the SL toolkit charts and instead looked for other components that support zooming and have a decent API to deal with it. These are the components I've found (though I'm sure there's more):
Visiblox Charts free version: it has a nice API and implenting zooming takes only a few lines of XAML according to this blog post (also see a post on a comparison with SL toolkit charts). Full disclosure: I have been heavily involved in development of this library.
Infragistics xamWebChart also claim to have support for zoom in the premium version of their charts
Telerik RadCharts also seem to allow zooming based on this example - though it's not clear to me whether you'd have to implement this functionality yourself.
Summing it up, I think the easiest way for you to go it with a component that already has zooming implemented - from my experience it would take a lot of investment to add proper zooming + panning to Silverlight Toolkit charts.

You should take a look at user610173's blog post. Specifically, download the full example code here: http://slchartzoomandpan.codeplex.com/SourceControl/list/changesets Very helpful!

Adding to Gergely Orozy comment about Telerik:
You can easily add the Zoom functionality with the following XAML.
<charting:ChartArea.ZoomScrollSettingsX>
<charting:ZoomScrollSettings ScrollMode="ScrollAndZoom" MinZoomRange="0.005"/>
</charting:ChartArea.ZoomScrollSettingsX>
You can check out a demo by clicking here and the source code is also available on that same tab.

Related

DynamicDataDisplay and other charting libraries for WPF apps

I am looking for a feature rich charting library, I've seen infragistics but it is not performant enough when there are many data points rendered, on the other hand I see DynamicDataDisplay is a pretty awesome library, but the project is not maintained anymore. Could you list other charting libraries that I should be aware of. I am looking from performance and customizability criteria.
You can try to download a trial version of LightningChart, the fastest and fully configurable Charting and Data visualization components for .Net. Examples are included in download package.
You also can read about benchmark and see for yourself.
I have plotted line charts with around a million data points using ChartDirector, and it can plot it well within 1 second. However, ChartDirector is a Windows Forms control, so it needs to be hosted in a WindowsFormsHost control when used in WPF. You can also just display the chart as an image in a WPF image control, but then you lose the user interaction features (track cursors, drag to zoom/scroll, ...).

WPF Charting + Grid help

We I'm looking for good WPF toolkit (ones that cost money) that can provide both powerful grid and charting. I'm not that up-to-date whats out there, so i was hoping anyone can assist me with where i should look for. some of the most needed features we need:
Grid:
Hierarchical tree grid
Charting:
panning and Zooming
3D charts
Empty Data point display
Line chart / Scatter Plot
any suggestion would be highly appreciated.
You might want to read this: https://stackoverflow.com/questions/1152016/best-charting-tool-for-silverlight-and-wpf
We're currently using two toolkits for WPF development:
Telerik
Infragistics
They both features charts and a powerful grid, plus a bunch of other things. There isn't much between them to be honest. Telerik seems to look a bit slicker. On the other hand the technical support you get from Infragistics is first class and well worth paying for. You can get a chat session with an actual developer within a couple of minutes and they usually have a solution for whatever problem you are facing.
I would happily recommend either of these.

High density Silverlight charting control

I've been looking into Silverlight charting controls to display a large number of samples, (~10,000 data points in five separate series - ~50k points all up).
I have found the existing options produced by Dundas, Visifire, Microsoft etc to be extremely poor performers when displaying more than a few hundred data points.
I believe the performance issues with existing chart controls is caused by the heavy use of vector graphics.
Ergo one solution would be a client-side chart control that uses the WritableBitmap class to generate a raster chart.
Before I fall too far down the wheel re-invention rabbit hole - has anyone found a third party or OSS control that will manage large numbers of data points on a sparkline?
Check out Visiblox ( http://www.visiblox.com/ ) Charts. I'm working on a telemetry application at the minute which uses three of their charts in the same Silverlight component, plotting about 36,000 points in total, and there is very little slowdown in terms of performance, if any at all.
They have a high performance example on their website here - http://www.visiblox.com/examples/LargeDataSets. I chose to use Visiblox after loooking at the following blog post:
New performance comparison: http://www.visifire.com/blog/2011/12/02/fast-silverlight-charts/
Old performance comparison: http://www.scottlogic.co.uk/blog/colin/2010/12/visiblox-visifire-dynamicdatadisplay-charting-performance-comparison/
My telemetry example is now part of a CodeProject article that I have created, if you want to take a look!
Based on the recommendations here, I have just trialled Visiblox and Infragistics.
Visiblox has a good developer experience, clean APIs, no bloat. While the performance is OK for a few thousand datapoints, performance breaks down as you go into the 100k range. Here's the Visiblox sample with a few thousand points (you can download the sample and just tweak the number of datapoints).
Now, the common argument here is that you should not bind that much data to a chart anyway, but should do some trimming beforehand. I do agree with that, but ideally, I want a chart control that does take care of that for me. Getting Zooming, Panning and all that right are non-trivial tasks and I'd be happy to shell out a few 100$ to get that functionality. It's plain economic common sense to not reinvent the wheel here.
Infragistics certainly gets that right. I can bind a million odatapoints and get smooth peformance. Here's the Infragistics sample.
However, Infragistics installs a lot of junk (a local IIS web app with the samples you can also see online) and besides the (excellent) samples and the code-level documentation, I do miss some high-level introduction to each component and it's individual modules.
Since a lot of people on SO recommend Telerik controls for their clean APIs, Documentation and Developer Support, I did also take a look at their chart control. However, I must admit I find it rather slow (Zooming takes roughly 500-1000ms, which is too long to feel smooth).
Here's the Telerik sample.
Visifire is the fastest chart now. Check out the blog link below.
http://www.visifire.com/blog/2011/12/02/fast-silverlight-charts/
The Chart image says Visifire is 3 to 4x faster than Visiblox..!
Before you start playing around with WritableBitmap on your own take a look at WriteableBitmapEx from René Schulte, he blogs about it here. Awesome stuff.
I don't know of any OSS or 3rd party controls that'll do what you need.
The one case where I've had the need for 100K+ of datapoints, we made it work by keeping it simple. The biggest perf killer was the number of elements within each datapoint. By keeping the element a simple ellipse with a static brush fill the app was rather snappy.
Infragistics claims to be able to handle massive amounts of data in their recently released xamDataChart.
http://www.infragistics.com/dotnet/netadvantage/silverlight/data-visualization/xam-web-data-chart.aspx#Overview
I believe the Telerik sample you are looking for can be found here. It shows large amounts of data that you can actually zoom in/out of. They also have a Server Load "Performance" Demo as well. Here is an example of the Scatter Chart with hundreds of data points.
Have you looked at the Telerik charting controls? Here is a link to one of their demos where they are using 100.000 data points:
http://demos.telerik.com/silverlight/#Chart/Sampling
I should also mention that I have not used the charting controls myself, so I cannot vouch for them. But the demos look good to me.
EDIT:
The link above has gone stale. Here is a link to the latest incarnation of the Telerik charting control They call it ChartView now:
http://demos.telerik.com/silverlight/#ChartView/FirstLook

Is there a good iTunes coverflow-type control for WPF?

I am currently using Telerik's carousel control, but it is lacking many features and is buggy. Is there a good control out there that looks the the coverflow control in itunes?
WPF Cover Flow Tutorial
Source Code: Part 7, Download
Author's rebuttal to claim of memory leak (it doesn't): Part 8
In Action: Videos
Contains a detailed walkthrough for building a coverflow control, including features such as reflection. I compiled and tried it out and pointed it to a directory containing hundreds of smallish images (you'll need to edit TestWindow.xaml.cs to point to a directory containing jpg's) and I was impressed with the performance and smoothness of the animation.
I noticed that using very large images degrades the performance though, so I'd recommend using images that are just the size needed for display. For example, when pointed to my desktop background images directory, there was nearly a one-second delay after pressing the arrow key and the item going through the transition (although the animation itself was still fluid, it took a moment to begin).
This is the best one that I found, for what I was looking for - namely, non-commercial, reflections, and smooth animation. I did look at the other ones currently mentioned in the other answers though, here are some comments on them (in no particular order):
FluidKit's ElementFlow
Open source, I used the latest source code, but did not try out any patches
Animation was smooth
Transition didn't feel very refined, the pictures clip each other in an odd way
Didn't seem geared for showing a handful of element's on the screen at once, it tries to show everything, and from some of the discussion comments, apparently isn't virtualized
After adding some images to the demo through the provided button, a large portion of them couldn't seem to get selected
Doesn't have reflections
Mindscape CoverFlow
Commercial
Animation was smooth
Doesn't "popup" selected item, feels very 2D
Has reflections
DevExpress Carousel
Commercial
No online demo and I didn't try to obtain the trial, looks polished though
Telerik Carousel
Commercial
Animation was smooth
The transition wasn't as pleasing to me, the new picture passed through the old one
Doesn't have reflections
Xceed Cardflow 3D
Commercial (professional edition only)
Animation was smooth, if you went quickly it would show blank cards speeding by and then fade in the actual data on the cards when you slowed down
Supports flipping the selected item, like in iTunes
Has reflections
ElementFlow control is inside the codeplex project called FluidKit - can be downloaded from here
For more details about the control - ElementFlow control at Pavan's blog
Mindscape now provide a commercial WPF Coverflow control as part of their WPF Elements control pack that might be useful also.
http://www.telerik.com/products/wpf/carousel.aspx
http://www.devexpress.com/Products/NET/Controls/WPF/Carousel/dependency_properties.xml
Both of these are FAR more versatile than your average cover flow clone (though they can easily just do that too if you want). I'd recommend Telerik well above DevExpress as WPF is still a relatively immature technology and DevExpress are very poor at keeping up with the tech game (they only JUST released a VS2010-supporting version of their DXperience suite despite promising it "just around the corner" since the start of January, while Telerik, ComponentOne etc all keep up with current tech. Not good enough for enterprise).

Designing a WPF map control

I'm thinking about making a simple map control in WPF, and am thinking about the design of the basic map interface and am wondering if anyone has some good advice for this.
What I'm thinking of is using a ScrollViewer (sans scroll bars) as my "view port" and then stacking everything up on top of a canvas. From Z-Index=0 up, I'm thinking:
Base canvas for lat/long calculations, control positioning, Z-Index stacking.
Multiple Grid elements to represent the maps at different zoom levels. Using a grid to make tiling easier.
Map objects with positional data.
Map controls (zoom slider, overview, etc).
Scroll viewer with mouse move events for panning and zooming.
Any comments suggestions on how I should be building this?
If you're looking for a good start, you can use the foundation of code supplied by the SharpMap project and build out from there. If I recall there were a few people already working on a WPF renderer for SharpMap, so you may also have some code to begin with.
I've personally used SharpMap in a C# 2.0 application that combined GIS data with real time GPS data, and it was very successful. SharpMap provided me the transformation suite to handle GIS data, along with the mathematical foundation to work with altering GIS information. It should be relatively straightforward to use the non-rendering code with a WPF frontend, as they already have presentation separated from the data.
(EDIT: added more details about how I used SharpMap)
It is probably a roundabout way of going about it, but you might find some useful stuff in the javascript and XAML from SilverlightEarth.com which a Silverlight 1.0-based map-tile-client. It can load VE, Google, Yahoo (there is a DeepZoom version that can load OpenStreetMap, Moon and Mars too; but since it uses MSI it doesn't really help on the WPF 3/3.5 front).
Although the javascript is a little untidy, you can clearly see it is creating a Silverlight 1.0 Xaml (dynamically sized) Canvas, filling it with tiles (Image controls) and handling zoom in/out and pan requests. You would need to make sense of all the javascript and convert it to C# - the XAML should mostly come into WPF unaltered. I have tested this Silverlight 1.0 with a Deep Zoom tile pyramid (and here) so the concepts are applicable (ie. not just for maps).
I know this works because I have done it myself to build the map viewer in Geoquery2008.com (screenshot) which is WPF/c#. Unfortunately the Geoquery2008 assemblies are obfuscated, but you might still glean some ideas or useful code via DASM/Reflector. It is still a beta so I wouldn't claim it is 100% done. I hadn't really thought of factoring out the map code into a separate control but may I will look into that if another one doesn't appear...
Incidentally I also started off with the ScrollViewer, but am planning to ditch it and mimic the javascript more closely so it's easier to re-use Image objects when panning/zooming (by gaining more control over the process than ScrollViewer provides).
These MSDN pages on the Virtual Earth tile system and the Deep Zoom file format and related links is probably also a useful reference.
Finally - I guess you've seen since this post that DeepZoom/MultiScaleImage is likely to be in .NET 4.0/Studio 2010.
Your desire to create a WPF mapping tool is similar to mine, which lead me to ask this question about DeepZoom (aka MultiScaleImage) from Silverlight. I want a WPF version. The accepted answer provides a link to a very good starting point (similar to your described thought process).
Virtual Earth has something favour to WPF
Don't know if you use ESRI software, but I hear there developing a Silverlight API for there stack so you might want to hold off.
It does not fall on my field of work at all, but you may have a look at MapWindow GIS, which has an Open Source ActiveX object that provides a lot of mapping and GIS features.
Here is a post explaining how to embed it on WPF applications:
http://www.mapwindow.org/phorum/read.php?13,13484
Download Bing Maps WPF Control sdk(Microsoft.Maps.MapControl.WPF.dll).Add as dll as referance,then change the XAML as below
**
<Window x:Class="WPFTestApplication.InsertPushpin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Width="1024" Height="768">
<Grid x:Name="LayoutRoot" Background="White">
<m:Map CredentialsProvider="INSERT_YOUR_BING_MAPS_KEY"
Center="47.620574,-122.34942" ZoomLevel="12">
<m:Pushpin Location="47.620574,-122.34942"/>
</m:Map>
</Grid>
</Window>
**
The main question is how you store and access the items you are going to put in the map (assuming this isn't just a picture display). Lookup scenegraph for some ideas.
Also if you want it to be more than a toy image viewer the lat long to XY scaling can get 'interesting'
Don't build it yourself - use the WPF Bing Maps Control
http://www.bing.com/community/site_blogs/b/maps/archive/2012/01/12/announcing-the-bing-maps-windows-presentation-foundation-control-v1.aspx
the Bing Maps Windows Presentation Foundation Control v1 is best map control in WPF.
Support for tile layers – you can now overlay your own tile layers atop the map control.
Turning off the base tile layer – this is useful for when you don’t need/want to use our base map tiles and instead would prefer to use your own without overlaying them atop of ours.The control won’t request the tiles which reduces downloads and improves rendering performance.
SSL Support – since many of you are using the WPF control in secure applications, you can now make tile and service request over SSL without issue.
Hiding the scale bar – if you don’t want a scale bar (perhaps your map is small and the scale bar clutters the map) you can turn it off. In fact, the only elements you can’t turn off are the Bing logo and the copyrights.
New copyright service – provides accurate copyright for our data vendors. Additional inertia – inertia is now enabled for the mouse and is on by default for touch.
Miscellaneous bug fixes – thanks for the feedback on the MSDN Forums, the Bing Maps Blog, e-mail and Twitter. Good finds people.

Resources