سؤال

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...

هل كانت مفيدة؟

المحلول

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;
}

نصائح أخرى

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

HTH

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top