wp7上的线图

编程入门 行业动态 更新时间:2024-10-03 08:25:17
本文介绍了wp7上的线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 amCharts 和他们的 SerialChart 与 LineGraph 相结合.我已经让它以这种方式工作:

I'm using amCharts and their SerialChart combined with a LineGraph. I've gotten it to work this way:

<amq:SerialChart x:Name="_24HoursLineGraph" DataSource="{Binding Data}" CategoryValueMemberPath="Date" AxisForeground="White" PlotAreaBackground="Black" GridStroke="DarkGray" Grid.Row="1" Margin="20"> <amq:SerialChart.Graphs> <amq:LineGraph ValueMemberPath="Close" Title="Close" Brush="Blue" /> </amq:SerialChart.Graphs> </amq:SerialChart>

背后的代码:

public ObservableCollection<Currency> Data { get { return _data; } } private ObservableCollection<Currency> _data = new ObservableCollection<Currency>(){}; void SetContext(Item[] itemArray) { _data = new ObservableCollection<Item>(); foreach (var item in itemArray) { _data.Add(item); } _data.OrderByDescending(i => i.Date); this.DataContext = this; }

我不明白如何定位折线图的数据上下文而不是设置整个数据透视表的数据上下文?我在三个不同的数据透视项中有三个图形,我需要分别设置它们的数据上下文.所以我想做一些类似的事情:

I don't understand how I can target the datacontext of the linegraph instead of setting the datacontext of the entire pivot? I have three graphs in three different pivot items and I need to set the datacontext of them individually. So instead I want to do something like:

_24HoursLineGraph.DataContext = theDataContext;

但这行不通.我还尝试使用 _24HoursLineGraph.Graphs[0].DataContext 访问线图本身,但这也不起作用.

But this doesn't work. I've also tried to access the linegraph itself with _24HoursLineGraph.Graphs[0].DataContext but that doesn't work either.

有什么建议吗?

推荐答案

Quick Charts 专为简单的场景而设计,多个图表只有一个数据源.快速图表不支持为每个图表使用完全独立的数据源.

Quick Charts is designed for simple scenarios with only one data source for multiple graphs. Using completely separate data sources for each graph is not supported in Quick Charts.

在您的情况下,您需要将所有数据源合并为一个,然后将每个图表上的 ValueMemberPath 设置为数据中的相应属性名称.

In your case you will need to merge all your data sources into one and then set ValueMemberPath on each graph to a respective property name in your data.

更多推荐

wp7上的线图

本文发布于:2023-07-09 10:16:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1085582.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:线图

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!