I want to graph enumeration values (by their integer values) but have strings displayed in Silverlight Toolkit Chart control - silverlight

In our application we allow users to chart enum values over time. We want the values plotted on the y-axis according to their integer values. However, we want the y-axis labelled with localized strings. And we'd like the "tooltip" diplayed when you hover over a plotted point to display a localized string.
I thought this would be "simple" since the Chart Control apparently will graph any IComparable data. So I created an EnumValue class that implements IComparable (based on int value) but that has a property named Value (used for binding) that is of type String.
So I thought I had been very clever and attempted to graph my EnumValues. When trying to display the graph of EnumValues I was told that the Chart control could not find a suitable axis to display the data. This makes sense as my data can't be plotted with the default LinearAxis. (I mean where would it plot the value "Off").
My question, is their a simple way to do this (like providing a map from int values to strings that the chart will automagically use), or will I have to define my own subclass of RangeAxis (or DisplayAxis) that tells the Chart how to plot these EnumValues.
I think creating the EnumAxis wouldn't be too hard, but their isn't a lot of documentation on what the methods need to do. (although you can gather a lot of info by looking at the other implementations).
Note, I'm currently trying to do this with Silverlight Toolkit Chart Control. But am evaluating Telerik and Software FX as well.

I did get this to work by creating my own Axis subclass.

Related

Curving chart diagram

My goal is to have a diagram which look like this
Each arrow should be a one dimensional chart, where point are displayed (colors and point size depends on some values)
I'm building my own chart system because I spent a few hours looking for one which allow to custom markers (size and colors, and maybe even shape) but I couldn't find one.
Actually the only one I found is dynamic data display 2.0 which is only proposed in Silverlight.
My biggest problem is the two curving chart I have to do at the top of the diagram.
I tried to use PathListBox control, but because it's a listBox, I couldn't display items at fixed X position (like using a chart).
I'm not asking for a full perfect solution, but can someone give me advices, or clues ?
How would you manage to do something like that ?
It should only be a XAML work here, because all the data are already ready in a ListCollectionView (i'm using MVVM).
Thank you !

Making WPF User Control transformations internal

I am developing my system using WPF with MVVM and I am having trouble to find out the best way to solve the following problem:
I have a screen in which many components (User Controls) are drawn at specific positions. All components in the screen are rotated, translated and scaled according to binded variables calculated by the screen's VM.
However, each of this components could have a different center for the rotation, a different origin for the translation and a different scale, dependent of internal variables and the screen scale.
How is it possible to make this transformations calculated internally in the User Control? I think the easier approach is using the Converter, however since I have many different User Controls with different behaviours, I would have to create multiple converters very similar to each other, which would not be the ideal solution.
Thank you very much for the help!
A UIElement has only one RenderTransformOrigin.
Some transformations allow you to set the origin for that transformation but in coordinates relative to the control bounds (e.g.: 125, 34) not in proportional coordinates like the RenderOrigin (e.g.: 0.5, 0.75)
So if you can use the coordinates you're good to go.
If not, you could compose the transformations by creating Transformation groups that first translate the control, then perform the transformation, and then translate the control back.
If you need more help, please post an example of what you are trying to achieve.

Display percentage value as a fill in a custom shape

I'm looking at some new options for displaying a percentage value as a fill in a custom shape. Consider the effect to be similar to a "progress thermometer" in a traditional dashboard UI sense.
Considerations
Goal - a graphic element showing a percentage value for a custom report.
Format - Either a full graphic (or infographic) itself, or part of a PDF via Photoshop/InDesign or even iBooks (as an excuse to use it).
Usage - I'd like the process to be programmatic, for re-use. It needs to be accurate, and I'd like the solution to be somewhat object oriented to apply to other datasets and graphical containers. This rules out hand-drawn charting.
Source data - currently a pivot table in Excel, but I can work with any other host as required.
Shape - is a custom vector shape that will originate from Illustrator/Inkscape. final format as best fits resolution and rendering of the report. I would also be interested in any other generative shape ideas (such as java/javascript).
Fill - I'd like to be able to represent the fill as both an actual percentage of total area (true up), and as a percentage of the vertical scale. I'd imagine this flexibility would also help reuse of the method as a fill value against selected object variables (height, area, whatever).
I know I'm being slightly vague in the programming languages or hosts side of things, but this gives me an opportunity to break out of the usual analytic toolchain and scope out some innovative or new solutions. I'm specifically interested in open source solutions, but I'm very keen to review other current methods you might suggest.
This might be a little open ended for you, but d3.js is very powerful. There might be some useful templates on the site, or you can build your own from the library.
If you limit yourself to shapes where the percentage can be easily converted into a new shape by varying one of the dimensions, then the display part can be covered by creating a second shape based on the first one, and filling in 100% of the second shape.
This obviously works best with simple shapes like squares, rectangles, circles, etc, where it is simple to convert "50% of the area" or "75% of the height" into manipulation of vector nodes.
However, things gets significantly more difficult if you want to support genuinely arbitrary custom shapes. One way to handle that would be to break up a complex "progress bar" into "progress pieces" (e.g. a thermometer bulb that represents 10% of total progress, then a simple bar for the remaining 90%).
As has been mentioned, D3 seems like it would meet your needs - here are some simple examples of what I think you are asking:
Changing the fill color of a distinct shape: http://jsfiddle.net/jsl6906/YCMb8/
Changing the 'fill amount' of a simple shape: http://jsfiddle.net/jsl6906/YCMb8/1/

Connect Silverlight Line Series Points Based On Dependent Value

Here's my current chart:
Is it possible to get the green and red series to connect points based on the dependent value (TVD) and not the independent value (Pressure)?
I'd like to connect the points based on the increase in TVD.
My series are bound to values found in a list of objects. The list of objects is sorted based on the increase in TVD, but when I bind my list to the series, the points connect based on increase in pressure.
I guess your Independent Axis (Pressure) is set to orientation X, and the Dependent Axis (TVD) is orientaton Y.
You should be able to get the results you want by setting the Independent Axis to the TVD value, and its orientation to Y. The pressure values would then go onto the Dependent Axis with orientation X.
I would hazard a guess that it isn't possible.
I was able to reproduce the chart sorting the points in X order. Indeed, it seems the LineSeries class (or rather its superclass, LineAreaSeriesBase, source), keeps the points in a collection ordered by independent value. So, the LineSeries will completely ignore the order in which you supply the points.
The next thing I tried was swapping the X and Y axes. I tried a few things that I thought would work but in the end all I got was an 'Assigned independent axis cannot be used' exception. Google turned up this post on the MSDN forums about a year ago, in which another user asks the same question and gets no helpful answers.
If you really want a chart plotting points in order of TVD, then I would have to recommend abandoning the Silverlight Toolkit chart and using a third-party control instead. Every time I've attempted to use the Silverlight Toolkit chart I've run up against an issue or an inflexibility with it. In my opinion it's just not good enough for production use. You're evidently working for the oil industry, so it's not like they can't afford a few hundred dollars for a licence for one of these libraries.

Silverlight toolkit chart too many labels on axis

I'm using the newest chart control from silverlight toolkit to plot some data. For small cases it works ok, but for bigger samples the X axis labels overlap. It would be no problem if the chart would simply omit some of the values or I could specify to just show every 10th of them ...
I couldn't find any properties providing this behavior. Any ideas?
Assuming this is a Linear axis then you can specify the interval to use via the the Interval property on the axis.
If the axis in question is Category Axis then dropping some labels may not be valuable to the user. One option is to use the LayoutTransfomer to rotate the labels to an angle reducing the width needed for each one. See this Delay Blog on the subject.

Resources