docs/shared/legends.md
{{~ if name != "Cartesian chart control" }}
:::info
This section uses the end ~}}CartesianChart control, but it works the same in the {{ name | to_title_case_no_spaces }} control.
:::
{{
A legend is a visual element that displays a list with the name, stroke and fills of the series in a chart:
This is a brief sample about how to use the main features of the IChartLegend<T> interface, you can find a more detailed article at the button below or at the
[API explorer]({{ website_url }}/api/{{ version }}/LiveChartsCore.Kernel.Sketches.IChartLegend-1).
You can place a legend at Top, Bottom, Left, Right or Hidden positions, notice the Hidden position will
disable legends in a chart, default value is Hidden.
{{~ if xaml ~}}
<pre><code><lvc:CartesianChart Series="{Binding Series}" LegendPosition="Top"><!-- mark --> </lvc:CartesianChart> <lvc:CartesianChart Series="{Binding Series}" LegendPosition="Bottom"><!-- mark --> </lvc:CartesianChart> <lvc:CartesianChart Series="{Binding Series}" LegendPosition="Left"><!-- mark --> </lvc:CartesianChart> <lvc:CartesianChart Series="{Binding Series}" LegendPosition="Right"><!-- mark --> </lvc:CartesianChart> <lvc:CartesianChart Series="{Binding Series}" LegendPosition="Hidden"><!-- mark --> </lvc:CartesianChart></code></pre>{{~ end ~}}
{{~ if blazor ~}}
<pre><code><CartesianChart Series="series" LegendPosition="LiveChartsCore.Measure.LegendPosition.Top"><!-- mark --> </CartesianChart> <CartesianChart Series="series" LegendPosition="LiveChartsCore.Measure.LegendPosition.Bottom"><!-- mark --> </CartesianChart> <CartesianChart Series="series" LegendPosition="LiveChartsCore.Measure.LegendPosition.Left"><!-- mark --> </CartesianChart> <CartesianChart Series="series" LegendPosition="LiveChartsCore.Measure.LegendPosition.Right"><!-- mark --> </CartesianChart> <CartesianChart Series="series" LegendPosition="LiveChartsCore.Measure.LegendPosition.Hidden"><!-- mark --> </CartesianChart></code></pre>{{~ end ~}}
{{~ if winforms ~}}
<pre><code>cartesianChart1.TooltipPosition = LiveChartsCore.Measure.LegendPosition.Bottom; // mark // or use Top, Left, Right or Hidden </code></pre>{{~ end ~}}