Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC 3.0 Chart Helper display Legend
    primarykey
    data
    text
    <p>Is there any way to display legend on chart using chart helper?</p> <p>It is not displaying it by default, there is no property i can say to display and if i specify legend in xml :</p> <pre><code>&lt;Legends&gt; &lt;Legend _Template_=""All"" BackColor=""Black"" Docking=""Bottom"" Font=""Trebuchet MS, 8.25pt, style=Bold"" LegendStyle=""Row"" &gt; &lt;/Legend&gt; &lt;/Legends&gt; </code></pre> <p>It is also not working.</p> <p>There is method in chart helper <code>public Chart AddLegend(string title = null, string name = null)</code>; but when i am calling it i can't see not the legend on my chart, chart not displaying as well.</p> <pre><code>Chart chart = new System.Web.Helpers.Chart(width: 120, height: 300, theme: chartStyle: ChartTheme.Green.ToString()) .AddLegend("title", "name") // not existed legends, that's why error. .AddSeries( chartType: "Column" legend: "Rainfall" xValue: new[] { "jan", "feb", "mar", "apr", "may" }, yValues: new[] { "20", "20", "40", "10", "10" }); </code></pre> <p>.Getting error: <code>Series 'Series1' uses non-existing legend name 'Rainfall'. Set Legend property value to Default</code></p> <p>If i change <code>legend: "Rainfall"</code> to <code>legend: "Default"</code> getting same error.</p> <p>How could i make this legend name existed? For example in case of using <code>System.Web.UI.DataVisualization.Charting</code> directly it will be looking like that:</p> <pre><code> chart.Legends.Add("Legend1"); // show legend based on check box value chart.Legends["Legend1"].Enabled = true; </code></pre> <p>But how to achieve the same thing with helper?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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