Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to align content of legend to left in Microsoft .net chart?
    primarykey
    data
    text
    <p>I have legend text of varying length and need to align the legend items to the left of the legend for a consistent layout.</p> <pre><code>| My Legend | | X what I have now | | X what I have now long | --&gt; causes irregular layout | X what I need | | X what I need long | --&gt; nice, regular layout </code></pre> <p>Must be something obvious but have been looking at this for hours and do not seem to be any closer to a working example. Thanks in advance for your help!</p> <p><strong>EDIT:</strong></p> <p>I am trying to produce a pie-chart so have multiple series, each of which will need the series symbol and the appropriate series datapoint text, as is the case in the default legend layout. My legend creation method:</p> <pre><code>public Legend CreateLegend() { var legend = new Legend(); legend.Enabled = true; legend.Font = new Font("Arial", 11F); legend.ForeColor = Color.FromArgb(102, 102, 102); legend.InsideChartArea = "Result Chart"; legend.Position = new ElementPosition(50, 20, 50, height); legend.LegendStyle = LegendStyle.Column; return legend; } </code></pre> <p>And my series creation method (which currently takes the legend as a parameter from my experiments/ideas for a solution here):</p> <pre><code>public Series CreateSeries(List&lt;ChartDivision&gt; series, Legend legend) { var seriesDetail = new Series(); seriesDetail.Name = "Result Chart"; seriesDetail.IsValueShownAsLabel = false; seriesDetail.ChartType = SeriesChartType.Pie; seriesDetail.BorderWidth = 2; foreach(var datapoint in series) { var p = seriesDetail.Points.Add(datapoint.Logged); p.LegendText = datapoint.Name; } seriesDetail.ChartArea = "Result Chart"; return seriesDetail; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload