WinRT-xaml-Toolkit: Line Series with median Line - xaml

Is there a way to implement a median Line using this lib?
The only way I think could work is adding a new LineSeries and add a median for each Value in my Data-LineSeries
Something like this:
<charting:Chart>
<charting:Chart.Series >
<charting:LineSeries ItemsSource="{Binding Articles}" Title="Test Title" Height="400" Width="400" IndependentValuePath="dateTime" DependentValuePath="price" >
</charting:LineSeries>
---Pseudo----
<charting:LineSeries x:Name="Median" ItemsSource="{Binding Articles}" Title="Median" IndependentValuePath="dateTime" DependentValuePath="median">
</charting:LineSeries>
</charting:Chart.Series>
</charting:Chart>
This would cause me to add the median Value of my Product to each Article which is..kinda unnecessary.
Is there an easier way to do this? Or even a way which fills the space between Data and Median with a certain color (e.g. http://www.jidesoft.com/images/line-chart-gradient-fill.png)?
Thanks in Advance

I don't think there are any built in statistical functions in the DataVisualization library that I ported from Silverlight Toolkit, but you can provide your own data source separate from your Articles one that has any range of values you want.
I also can't recall if the filled style of the data series visualization is implemented, but you could try to create a modified version of the LineSeries one that does support Fill or check the source if any such property is already available. It might be doable by simply changing the Style of the series.

Related

libreoffice calc arithmetic inside number formatting?

Is it possible to perform arithmetic inside a formatting declaration? I want to display =1 as 1mg, =0.1 as 100 mcg, =0.0001 as 100ng, etc.
For the milligram one, you can do:
0" mg"
For division, (by 1000) you can use:
#,##0.000,;-#,##0.000,
(Then just add a label to it.)
Edit:
After looking around on the web, I found something fairly similiar that allows scaling from Hz - GHz. It uses another cell and some IFs to format, but likely will be the best solution for what you are doing. (Afaik, excel format does not support macro-ing)
The code to modify cell A1 is:
=IF(A1>=10^6,TEXT(A1/10^6,"0.0#")&" MHz",IF(A1>=10^3,TEXT(A1/10^3,"0.0#")&" KHz",TEXT(A1,"0.0#")&" Hz"))
(Referenced from: Link)

Set histogram ticks/label using Syntax

Let me preface this by saying that I am a programmer by trade, but not very familiar with SPSS.
I am helping a friend set up some histogram plots using SPSS Syntax language. Using the Chart Builder, we have arrived at the code below:
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=OurVariable MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE
TEMPLATE=[
"C:\some\path\greenHistogram.sgt"].
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: OurVariable=col(source(s), name("OurVariable"))
GUIDE: axis(dim(1), label("OurVariable"))
GUIDE: axis(dim(2), label("Frequency"))
GUIDE: text.title(label("Bla bla",
"bla"))
ELEMENT: interval(position(summary.count(bin.rect(OurVariable, binStart(0.5)))),
shape.interior(shape.square))
END GPL.
As you can see, she would like to make the histogram columns green. We could not achieve that using the Chart Builder, but we could easily make a template via the Chart Editor window and apply that. This seems like a very sensible approach, as she has many charts she wants green.
She would also like to customize the y-axis labels (number of decimal places, tick "major increment" etc.). This can also be achieved using the Chart Editor and saving a template. However, this is a much more individualized edit, and making a custom template for each and every plot seems cumbersome. Is it possible to adjust these things directly in the Syntax-script which generates the plots?
In many other places there is a nice Paste-button which generates the necessacy code, but I could not find one in the Chart Editor.

How to use comma separator to display my double value as currency value in WinRT?

i want to use comma separator to display my double value as currency value in WinRT XAML?
like
<TextBlock Text="{Binding Amount, StringFormat={}{0:C}}" />
I need to achieve this in XAML, not in C# using IValueConverter.
Thanks in advance.
Joy Rex
Sounds like something that should be delegated to be handled by the platform, not by some arbitrary format string, doesn't it? I believe this should happen automatically for users using a locale that uses commas as separators such as Polish. I don't have much recent experience with that in .NET, but perhaps a decimal type would make it work if double doesn't. Also remember that you can simply expose an AmountAsString property that is formatted by your view model since you only bind it one-way into a TextBlock anyway. Oh and otherwise - there is nothing wrong with an IValueConverter.
Just to note on this thread, the Windows.Globalization.NumberFormatting APIs are available for both currency and decimal formatting, and automatically applies the user's locale-specific or customized number formats along with currency symbol placement. The Number formatting and parsing sample shows all the variations.

XAML: Batch define elements of a column in a Grid

When defining the contents of a Grid, I first define all row and column definitions, then afterwards when defining elements I have to explicitly specify which row and column they belong to. Not only is it tedious, but if I add an element somewhere between the others I have to manually shift the index of everything that follows. So I wondered if it was possible to batch-define elements within a column or row, for example something like
<Column.Content Index="0">
<Label>First row</Label>
<Label>Second row</Label>
<Label>Third row</Label>
</Column.Content>
..or similar? Something like how the <table> HTML tag works would also be awesome.
Given your problem I think you should give in to the magic of databinding and let WPF do the hard work of moving data around if new data is inserted: have a look here http://social.msdn.microsoft.com/Forums/is/wpf/thread/2f5173fd-a9ef-4a5b-9fa8-b68e4255dac4

Multiple Colors In TextBlock

Is it possible to add dynamic colors to a TextBlock ..i.e. have one character in one color and the next in another color.
<TextBlock Text="{Binding no}" TextWrapping="Wrap" Margin="10,0,0,0" Style="{StaticResource PhoneTextSubtleStyle}" FontSize="40" Foreground="#A400C4FF" >
// Can we add something here to specify what colours for what chars
</TextBlock>
Basically I input a dynamic 4 character sequence from no. I've bound it to this TextBlock inside a ListBox. Is it possible to have the characters in different colors.
If so is it possible to add these colors dynamically for eg. If I click a button certain characters change color?
Thank You. Any Help is appreciated.
Actually, you can, which can come in handy when you're doing a StringFormat on a data bound Textblock or a number of other places.
If you did want to try it though, like here's an SL example for a form label that puts a red asterisk next to the text Required Fields, but then can also add more stuff to it as shown in the example. Should work for Silverlight, WPF, UWP, etc...
<TextBlock>
<Run Text="*" Foreground="#FFE10101"/><Run Text="Required Line" />
<Run Text="Red" Foreground="Red"/>
<Run Text="Blue" Foreground="Blue"/>
<Run Text="{Binding SomeString, StringFormat='Hell ya you can make \{0\} a different color!'}" Foreground="Orange"/>
</TextBlock>
I'm developing for Mango with the WP7 SDK. You can use a <Run>. It seems a little buggy on WP7 , you have to add a spaces on the Run.Text property to get the spacing correct:
<TextBlock>Hello<Run Foreground="Bisque" Text=" Holla "></Run>and hello again!</TextBlock>;
to set foreground color dynamically to a textblock
use: txtblockname.Foreground= new SolidColorBrush(Colors.Yellow);
The TextBlock does not support multiple Foreground colors.
You could recreate this behaviour by using multiple textblocks (one for each letter) and placing them within a wrappanel. You could then change the color of individual characters/letters as you wish.
Beware of the probable performance impact this may have. The margins around individual letters will need to be adjusted to recreate standard behaviour though. Be especially careful around punctuation.