We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Regarding Legend Color with line chart

Thread ID:

Created:

Updated:

Platform:

Replies:

82340 Jun 9,2009 06:40 PM UTC Jun 10,2009 12:27 PM UTC Windows Forms 1
loading
Tags: Chart
Administrator [Syncfusion]
Asked On June 9, 2009 06:40 PM UTC

Hi


I have make line chart with adding 10 series like that
_chartControlLineGraph.LegendPainted = false;
_series1 = this._chartControlLineGraph.Model.NewSeries("120", ChartSeriesType.Line);
_series1.Text = _series1.Name;
_series1.Points.Add(100, 600);
_series1.Points.Add(200, 100);





//_series1.Points.Add(200, 00);
//_series1.Points.Add(200, 100);
//_series1.Points.Add(300, 900);
//_series1.Points.Add(400, 400);
//_series1.Points.Add(500, 1000);
//_series1.Points.Add(600, 800);
//_series1.Points.Add(700, 300);
//_series1.Points.Add(800, 700);
//_series1.Points.Add(900, 500);
//_series1.Points.Add(1000, 200);
_series2 = this._chartControlLineGraph.Model.NewSeries("110", ChartSeriesType.Line);
_series2.Text = _series2.Name;
_series2.Points.Add(200, 100);
_series2.Points.Add(300, 900);
//_chartControlLineGraph.Legends.Add(_chartLegend);
//_series2.LegendName = _chartLegend.Name;
_series3 = this._chartControlLineGraph.Model.NewSeries("100", ChartSeriesType.Line);
_series3.Text = _series3.Name;
_series3.Points.Add(300, 900);
_series3.Points.Add(400, 400);
//_chartControlLineGraph.Legends.Add(_chartLegend);

_series4 = this._chartControlLineGraph.Model.NewSeries("90", ChartSeriesType.Line);
_series4.Text = _series4.Name;
_series4.Points.Add(400, 400);
_series4.Points.Add(500, 1000);
//_chartControlLineGraph.Legends.Add(_chartLegend);
_series5 = this._chartControlLineGraph.Model.NewSeries("80", ChartSeriesType..Line);
_series5.Text = _series5.Name;
_series5.Points.Add(500, 1000);
_series5.Points.Add(600, 800);
//_chartControlLineGraph.Legends.Add(_chartLegend);
_series6 = this._chartControlLineGraph.Model.NewSeries("70", ChartSeriesType..Line);
_series6.Text = _series6.Name;
_series6.Points.Add(600, 800);
_series6.Points.Add(700, 300);

_series7 = this._chartControlLineGraph.Model.NewSeries("60", ChartSeriesType.Line);
_series7.Text = _series7.Name;
_series7.Points.Add(700, 300);
_series7.Points.Add(800, 700);
_series8 = this._chartControlLineGraph.Model.NewSeries("50", ChartSeriesType..Line);
_series8.Text = _series8.Name;
_series8.Points.Add(800, 700);
_series8.Points.Add(900, 500);
_series9 = this._chartControlLineGraph.Model.NewSeries("40", ChartSeriesType..Line);
_series9.Text = _series9.Name;
_series9.Points.Add(900, 500);
_series9.Points.Add(1000, 200);
_series10 = this._chartControlLineGraph.Model.NewSeries("30", ChartSeriesType.Line);
_series10.Text = _series10.Name;
_series10.Points.Add(1000, 200);
_series10.Points.Add(1100, 200);

_chartControlLineGraph.Series.Add(_series1);
_chartControlLineGraph.Series.Add(_series2);
_chartControlLineGraph.Series.Add(_series3);
_chartControlLineGraph.Series..Add(_series4);
_chartControlLineGraph.Series.Add(_series5);
_chartControlLineGraph.Series.Add(_series6);
_chartControlLineGraph.Series.Add(_series7);
_chartControlLineGraph.Series.Add(_series8);
_chartControlLineGraph.Series.Add(_series9);
_chartControlLineGraph.Series.Add(_series10);

for each series i assign diffrent color but my legend's color is not match with line color.
Is it also will i customize the legend shape(recentagle instead of line).

(See the attached image with this)

Thanks




Line_62636acf.zip

Manimala S [Syncfusion]
Replied On June 10, 2009 12:27 PM UTC

Hi Prasad,

Thanks for using Syncfusion Products.

To set the color for the series, use the interior property of the series which will set the color for both the series and the legend.

Here is the code snippet.

//Code
this.chartControl1.Series[0].Style.Interior = new BrushInfo(GradientStyle.Horizontal,color[0],color[0]);

We can also change the legend symbol. Below is the code snippet to do so.

//Code

this.ChartWebControl1.Legend.RepresentationType = ChartLegendRepresentationType.Diamond;
this.ChartWebControl1.Legend.Items[0].Interior = new BrushInfo(Color.Violet);


Kindly, let me know if it helps.

Thanks,
Manimala.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;