0

I need to implement candlestick charts in windows metro app.Im not looking for any chart controls like visfire..ineed an open source code or a way ow to build it...Please help me...

Farhan Ghumra
  • 15,180
  • 6
  • 50
  • 115
Sudeep george
  • 111
  • 1
  • 11

2 Answers2

3

OxyPlot is an open source, cross-platform .NET plotting library. It is available for WPF, Windows Store Apo, Silverlight & Windows Forms.

CodePlex Page : http://oxyplot.codeplex.com/

NuGet Package (You must have installed NuGet v2.1 or more) : http://nuget.org/List/Packages/OxyPlot.Metro

Sample App : http://apps.microsoft.com/webpdp/app/oxyplot-example-browser/95b37c05-f2b0-4186-b48e-01b6fcbeec5d

Here I am giving you demo of how to use candle stick series chart in Windwos store app

XAML

I have taken xmlns:oxy="using:OxyPlot.Metro" intag

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <oxy:Plot x:Name="Plot1" Background="White"/>
</Grid>

C#

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    Plot1.Model = CandleStickSeries();
}

public PlotModel CandleStickSeries()
{
    PlotModel plotModel = new PlotModel("Candle Stick Series", null)
    {
        LegendSymbolLength = 24.0
    };
    CandleStickSeries candleStickSeries = new CandleStickSeries("random values")
    {
        Color = OxyColors.Black
    };
    Random random = new Random();
    double num = 100.0;
    for (int i = 0; i < 16; i++)
    {
        num = num + random.NextDouble() + 0.1;
        double num2 = num + 10.0 + random.NextDouble() * 10.0;
        double num3 = num - (10.0 + random.NextDouble() * 10.0);
        double open = num3 + random.NextDouble() * (num2 - num3);
        double close = num3 + random.NextDouble() * (num2 - num3);
        candleStickSeries.Items.Add(new HighLowItem((double)i, num2, num3, open, close));
    }
    plotModel.Series.Add(candleStickSeries);
    plotModel.Axes.Add(new LinearAxis(AxisPosition.Left, double.NaN, double.NaN, null)
    {
        MaximumPadding = 0.3,
        MinimumPadding = 0.3
    });
    return plotModel;
}
Farhan Ghumra
  • 15,180
  • 6
  • 50
  • 115
1

This is the only open source chart implementation for WindowsPhone I know: amCharts

HTH

paiden
  • 887
  • 7
  • 15
  • The question is regarding Windows Store App, not for Silverlight, WPF or Windows Phone – Farhan Ghumra Apr 03 '13 at 10:06
  • Yep you're right. I think, I was still in WinPhone context from another question. – paiden Apr 03 '13 at 10:09
  • is it compaitable for windows 8 metro apps? – Sudeep george Apr 03 '13 at 10:11
  • I dont think it is fully compatible. But you should get a lot of information on how to draw charts in ModernUI apps by looking at the source code. Many classes used in amCharts to draw the charts on WindowsPhone also exist in XAML ModernUI Framework (Canvas, Brush...). – paiden Apr 03 '13 at 10:19