Silverlight 银光图表问题

Silverlight 银光图表问题,silverlight,silverlight-4.0,charts,Silverlight,Silverlight 4.0,Charts,我还没有足够的代表点来发布图像,但给出了一个使用ColumnSeries的Silverlight 4图表示例,如何使当前堆叠在彼此顶部的单个列中的每个子列并排放置 e、 g列NVQ2显示5个不同位置的值列,列NVQ3显示5个不同位置的值列 我需要的位置并排坐着,而不是堆叠在一起 图形的代码: foreach (ER_Location theLocation in UserSelections.TheDataSet.ER_Locations) {

我还没有足够的代表点来发布图像,但给出了一个使用ColumnSeries的Silverlight 4图表示例,如何使当前堆叠在彼此顶部的单个列中的每个子列并排放置

e、 g列NVQ2显示5个不同位置的值列,列NVQ3显示5个不同位置的值列

我需要的位置并排坐着,而不是堆叠在一起

图形的代码:

foreach (ER_Location theLocation in UserSelections.TheDataSet.ER_Locations)
                    {
                        ER_Year myYear = (ER_Year)SeriesSelection.SelectedItem;
                        ColumnSeries newSeries = new ColumnSeries();
                        newSeries.ItemsSource = UserSelections.GetDataRowsByYearAndLocation(theLocation.Location_ID, (int)myYear.Year);
                        newSeries.IndependentValueBinding = new System.Windows.Data.Binding("Variable_ID");
                        newSeries.DependentValueBinding = new System.Windows.Data.Binding("Value");
                        newSeries.Title = theLocation.Name;
                        newSeries.IsSelectionEnabled = true;
                        MainChart.Series.Add(newSeries);
                    }
更新:

以下是当前图表的呈现方式:

我猜您的代码使用了以下
语句:-

using System.Windows.Controls.DataVisualization.Charting.Compatible
实际上有两种不同的类型,名称为
ColumnSeries
。一个位于上述名称空间中,它派生自
StackedColumnSeries

但是,主图表名称空间中存在原始的非堆叠
ColumnSeries
。此类型将并排放置每个柱。因此,我怀疑您需要做的就是使用
从您的
中删除额外的
.Compatible
:-

using System.Windows.Controls.DataVisualization.Charting;

您必须创建一个具有color属性的类

例如

public class MyColor
{
    public Brush ChartColor { get; set; }
}
然后创建一个你最喜欢的颜色列表,如

List<MyColor> colorList = new List<MyColor>
{
    new MyColor
      { ChartColor = new SolidColorBrush(Colors.Blue)},
    new MyColor
      { ChartColor = new SolidColorBrush(Colors.Green) },
    ...
    ...
}
List colorList=新列表
{
新霉色
{ChartColor=new SolidColorBrush(Colors.Blue)},
新霉色
{ChartColor=new SolidColorBrush(Colors.Green)},
...
...
}

从Xaml中,将数据点的背景色绑定到ChartColor

在引用图表时,您是否使用通常意义上的术语“堆叠”?通常情况下,图表中的多列序列会将特定独立值的每列并排放置。你需要使用StackedColumnSeries让它们堆叠起来。如果我今晚能将我的代表人数增加到10人,我明天会发布一张图片,从视觉上解释这一点!我现在不能发布图片。加上当前的渲染方式,也许这能更好地说明问题。非常感谢。非常感谢这个,安东尼,这是并排展示酒吧的作品。然而,所有的酒吧现在都显示在同一个颜色,而在他们出现在不同的颜色?有什么明显的我应该做的吗?