代码之家  ›  专栏  ›  技术社区  ›  code4life

同步融合图表问题

  •  1
  • code4life  · 技术社区  · 14 年前

    我使用的是Visual Studio 2008,SyncFusion Essential Studio Enterprise Edition(WinForms)7.203.0.20版。

    我想知道是否有人能帮我解决一个小问题:如何为我的折线图中的每一行指定自定义颜色?

    1 回复  |  直到 14 年前
        1
  •  4
  •   Jay    14 年前

    要设置折线图的颜色:

    this.chartControl1.Series[0].Style.Interior = new BrushInfo(GradientStyle.Vertical, Color.Red, Color.Orange);

    这是一个帮助链接- http://www.syncfusion.com/support/kb/83/How-do-I-set-the-Interior-colors-for-the-chart-series-data-points

    如果希望个别连接线具有不同的颜色,则需要按如下方式处理ChartSeries.PrepareStyle事件:

    this.chartControl1.Series[0].PrepareStyle += new ChartPrepareStyleInfoHandler(series_PrepareStyle);

    void系列_PrepareStyle(对象发送方,ChartPrepareStyleinForEventArgs参数) { //使用准备样式事件为数据点指定不同的颜色 ChartSeries Series=作为ChartSeries的发送方; 如果(系列)!=空) { if(this.chartcontrol1.series[0].type.toString()==“行”) { if(args.index==0) args.style.interior=新建syncfusion.drawing.brushinfo(color.red); else if(args.index==1) args.style.interior=新建syncfusion.drawing.brushinfo(color.green); else if(args.index==2) args.style.interior=新建syncfusion.drawing.brushinfo(color.blue); else if(args.index==3) args.style.interior=new-syncfusion.drawing.brushinfo(color.yellow); else if(args.index==4)

    http://samples.syncfusion.com/sfwinsamples82/Chart.Windows/Chart%20Types/Line%20Charts/Sample.aspx?args=1

    当做, 杰伊