我正在使用 Telerik RadChart 绘制折线图。一切都很好,除了零值没有显示为附件。
是否存在负责此行为的外观属性?
我正在创建这样的控件:
/// <summary>
/// builds the chart object
/// </summary>
/// <param name="chartSeriesItems">Series Items For index values</param>
/// <param name="chartAvrageSeriesItems">Avrage 2 seies items for start and end</param>
/// <returns></returns>
private RadChart BuildChart(List<ChartSeriesItem> chartSeriesItems, List<ChartSeriesItem> chartAvrageSeriesItems)
{
RadChart chart = new RadChart();
chart.ID = "SparklineChart";
chart.Width = 200;
chart.Height = 140;
chart.DefaultType = ChartSeriesType.Line;
chart.AutoLayout = true;
chart.ChartTitle.Visible = false;
chart.Appearance.Dimensions.Margins = ChartMargins.Parse("0px, 0px, 0px, 0px");
chart.Appearance.Dimensions.Paddings = ChartPaddings.Parse("0px, 0px, 0px, 0px");
chart.Appearance.Dimensions.AutoSize = true;
chart.Appearance.Dimensions.Height = 140;
chart.Appearance.Dimensions.Width = 200;
chart.Appearance.FillStyle.FillType = FillType.Solid;
chart.Appearance.FillStyle.MainColor = Color.Transparent;
chart.Appearance.Border.Visible = false;
chart.Legend.Visible = false;
chart.PlotArea.XAxis.Visible = ChartAxisVisibility.False;
chart.PlotArea.YAxis.Visible = ChartAxisVisibility.False;
chart.PlotArea.Appearance.Dimensions.Margins = ChartMargins.Parse("0px, 0px, 0px, 0px");
chart.PlotArea.Appearance.Dimensions.Paddings = ChartPaddings.Parse("0px, 0px, 0px, 0px");
chart.PlotArea.Appearance.FillStyle.FillType = FillType.Solid;
chart.PlotArea.Appearance.FillStyle.MainColor = Color.Transparent;
chart.PlotArea.Appearance.Border.Visible = false;
chart.PlotArea.EmptySeriesMessage.TextBlock.Appearance.AutoTextWrap = AutoTextWrap.True;
chart.PlotArea.EmptySeriesMessage.TextBlock.Text = Resources.Text.NoData;
//add series
ChartSeries scoreSeries = new ChartSeries();
scoreSeries.Name = "Score";
scoreSeries.DefaultLabelValue = "#Y" + FormatText.GetFormat(Global.GetUserProfile().NumbersFormat, Global.GetUserProfile().DecimalDigits).Replace("0:", "");
scoreSeries.Appearance.FillStyle.MainColor = Color.Black;
scoreSeries.Appearance.LabelAppearance.Visible = true;
scoreSeries.Type = ChartSeriesType.Line;
scoreSeries.Items.AddRange(chartSeriesItems);
ChartSeries avrageSeries = new ChartSeries();
avrageSeries.Name = "Avrage";
avrageSeries.DefaultLabelValue = "#Y" + FormatText.GetFormat(Global.GetUserProfile().NumbersFormat, Global.GetUserProfile().DecimalDigits).Replace("0:", "");
avrageSeries.Appearance.FillStyle.MainColor = Color.Gray;
avrageSeries.Appearance.LabelAppearance.Visible = true;
avrageSeries.Type = ChartSeriesType.Line;
avrageSeries.Appearance.LineSeriesAppearance.Width = 1;
avrageSeries.Items.AddRange(chartAvrageSeriesItems);
chart.Series.Add(scoreSeries);
chart.Series.Add(avrageSeries);
return chart;
}
我正在添加这样的值:
ChartSeriesItem seriesItem = new ChartSeriesItem()
{
Name = "1",
XValue = index++,
YValue = 200
};
totalYValue += 200;
seriesItem.Label.Appearance.FillStyle.MainColor = SAObjectsUtilities.GetColorFromStatus(SA_Globals.Status.Blue);
//seriesItem.Label.TextBlock.Appearance.TextProperties.Color = SAObjectsUtilities.GetLabelForeGroundColor(item.ScoreStatus);
seriesItem.Label.TextBlock.Appearance.TextProperties.Font = new Font(new FontFamily("Arial"), 7);
seriesItem.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
chartSeriesItems.Add(seriesItem);
ChartSeriesItem seriesItem2 = new ChartSeriesItem()
{
Name = "2",
XValue = index++,
YValue = 0
};
totalYValue += 0;
seriesItem2.Label.Appearance.FillStyle.MainColor = SAObjectsUtilities.GetColorFromStatus(SA_Globals.Status.Red);
//seriesItem.Label.TextBlock.Appearance.TextProperties.Color = SAObjectsUtilities.GetLabelForeGroundColor(item.ScoreStatus);
seriesItem2.Label.TextBlock.Appearance.TextProperties.Font = new Font(new FontFamily("Tahoma"), 7);
seriesItem2.Label.TextBlock.Appearance.TextProperties.Color = Color.Black;
chartSeriesItems.Add(seriesItem2);