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. Image for the cookie policy date
close icon

custom legend

what is the easiest way for me to render a completely custom legend, hopefully reusing some elements of the existing one where necessary... (e.g. the icon/representation).

thanks,

5 Replies

AD Administrator Syncfusion Team September 24, 2007 09:10 AM UTC

Hi Kamen,

Thank you for using Syncfusion products.

Please refer the following customizations available for chart legend.

1) The appearance of the Chart Legend in Essential Chart can be customized through various properties exposed by the ChartControl’s ChartLegend object.

2) The symbol of the legend can also be easily customized to have any shape of the user’s choice using the RepresentationType property of the ChartLegend class.

[C#]
this.chartControl1.Legend.RepresentationType = ChartLegendRepresentationType.Circle;

3) The series-legend that is being displayed next to each data point in a series, can be customized with respect to Size, Style, Color etc. using the various properties supported by corresponding ChartSeries Style.

[C#]
foreach (ChartSeriesLegendItem item in this.chartControl1.Legend.Items)
{
item.Series.Style.Font.Facename = fontname;
}
this.chartControl1.Refresh();

4) ChartLegendFilterItems Event handler is used to change the collection of Legend Items that the legend renders.

5) The chart legend can be positioned easily anywhere in the ChartControl. The position of the chart legend can be changed by using Position property of the ChartLegend class.

[C#]
this.chartControl1.LegendPosition = ChartDock.Left;

6) The items of chart legend can be displayed in multiple rows and columns by adjusting the RowsCount/ColumnsCount properties of the ChartLegend class.

[C#]
this.chartControl1.Legend.RowsCount = 1; this.chartControl1.Legend.ColumnsCount = 2;

Please refer sample for above said features in the below location.

[Install drive]:\Documents and Settings\USERNAME\My documents\ Syncfusion \..\Chart.Windows\Samples\2.0\Chart Legend\ChartLegend

Can you please elaborate on reuse mechanism in customizing the chart legend?

Also please let me know if you have any other queries.

Regards,
Jaya


KY Kamen Yotov September 25, 2007 01:37 PM UTC

Thanks for replying.

I need to render a completely custom legend, as I believe what I need is not supported in the ChartLegend properties...

For example, I need to render the legened as a table, where the columns represent different statistics for the series... see attached mock-up.

I am close to deciding to tell the chart not to show a legend and then use essential grid to render a custom legend below the chart, but i wanted to ping your opinion.

thanks!

image.zip


AD Administrator Syncfusion Team October 2, 2007 05:58 PM UTC

Hi Kamen,

Thanks for the update.

To achieve your requirement you can embed Essential Grid on the Chartcontrol since ChartLegend is rendered as an image, you cannot display statistics information in ChartLegend.

Please let me know if you have any other queries.

Regards,
Jaya


KY Kamen Yotov October 5, 2007 04:14 PM UTC

I did exactly that -- used a grid, but I did not embed it in the chart control... I just put it below the chart as a separate control. What do you mean by embed? Is there a way to integrate it more tightly, so that e.g. I can drag it around like the original legend?


AD Administrator Syncfusion Team October 6, 2007 08:44 AM UTC

Hi Kamen,

Thanks for the update.

You can place GridControl over the ChartControl. But you cannot integrate tightly with GridControl. Sorry if I was not clear to you.

Please let us know if you require any further assistance.

Regards,
Jaya

Loader.
Live Chat Icon For mobile
Up arrow icon