0

我需要在 Windows Metro 应用程序中实现烛台图表。我不是在寻找任何图表控件,如 visfire..需要开源代码或构建它的方法......请帮助我......

4

2 回答 2

3

OxyPlot 是一个开源的跨平台 .NET 绘图库。它适用于 WPF、Windows Store Apo、Silverlight 和 Windows 窗体。

CodePlex 页面: http: //oxyplot.codeplex.com/

NuGet 包(您必须已安装 NuGet v2.1 或更高版本): http: //nuget.org/List/Packages/OxyPlot.Metro

示例应用程序: http: //apps.microsoft.com/webpdp/app/oxyplot-example-browser/95b37c05-f2b0-4186-b48e-01b6fcbeec5d

在这里,我给你演示如何在 Windwos 商店应用程序中使用烛台系列图表

XAML

我已经采取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;
}
于 2013-04-03T15:10:01.583 回答
1

这是我所知道的 WindowsPhone 的唯一开源图表实现:amCharts

高温高压

于 2013-04-03T09:58:13.283 回答