【问题标题】:How to make series labels to show without overlapping each other? ASP.NET 4.0如何使系列标签显示而不会相互重叠? ASP.NET 4.0
【发布时间】:2012-10-01 09:24:59
【问题描述】:

我正在开发一个图表(使用 ASP.NET CHART CONTROL),上面有大约 2 或 3 个系列。请看看它现在的样子。如您所见,标签相互重叠,看起来不太好。有什么办法可以解决这个问题并改善图表的整体外观?

谢谢。

我的代码:

series.ChartType = SeriesChartType.Line
series.YValueType = ChartValueType.Double
series.XValueType = ChartValueType.String
series.BorderWidth = 1
series.ShadowOffset = 1
series.IsValueShownAsLabel = True
series.ToolTip = dtrow.ToString
series.LabelForeColor = Color.Gray

series.LabelToolTip = dtrow.ToString

ChartRatings.Series.Add(series)

【问题讨论】:

    标签: asp.net charts series microsoft-chart-controls


    【解决方案1】:

    启用智能标签。

    Chart1.Series["Series1"].SmartLabels.Enabled = true;
    

    看这里SmartLabels

    【讨论】:

    • 死链接以及 .SmartLabel 似乎是 Dundas 属性,而不是 ASP.NET 图表。我只看到 Chart1.Series["Series1"].SmartLabelStyle... 及其子属性。参考。 msdn.microsoft.com/en-us/library/…
    【解决方案2】:

    您还可以在图表之外设置标签,以便更清晰地展示。

    Chart1.Series[0]["PieLabelStyle"] = "Outside";
    

    更多内容请参考这里的好文章:http://betterdashboards.wordpress.com/2009/01/20/overlapping-labels-on-a-pie-chart

    【讨论】:

      【解决方案3】:

      添加到标记的答案,你也可以添加这些

       chart1.Series[1].SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes
       chart1.Series[1].SmartLabelStyle.IsMarkerOverlappingAllowed = False
       chart1.Series[1].SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Right
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多