Legend Position

Use the legend.position property to determine the position of the legend. The "Auto" position places the legend to the right or below the chart depending on the control size:

SalesExpensesDownloadsUSGermanyUKJapanItalyGreece010,000
1
2
3
4
5
6
7
8
9
// This file locates: "Scripts/Lesson/C1FlexChart/LegendPosition.js".
c1.documentReady(function () {
    var theChart = wijmo.Control.getControl('#theChart');
    var legendPosition = wijmo.Control.getControl('#legendPosition ');
 
    legendPosition.textChanged.addHandler(function (s, e) {
        theChart.legend.position = s.text;
    });
});
1
2
3
4
5
6
7
8
9
10
11
12
13
using System.Web.Mvc;
 
namespace LearnMvcClient.Controllers
{
    public partial class C1FlexChartController : Controller
    {
        // GET: LegendPosition
        public ActionResult LegendPosition()
        {
            return View(Models.FlexChartData.GetSales1());
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@using LearnMvcClient.Models
@model IEnumerable<FlexChartData.Sale>
 
@{
    var positions = new[] { "None", "Top", "Bottom", "Left", "Right", "Auto" };
}
 
<h1>
    @Html.Raw(Resources.C1FlexChart.LegendPosition_Title)
</h1>
 
<p>
    @Html.Raw(Resources.C1FlexChart.LegendPosition_Text1)
</p>
 
<div class="demo-settings">
    <label for="legendPosition">@Html.Raw(Resources.C1FlexChart.LegendPosition_Text2) </label>
    @Html.C1().ComboBox().Id("legendPosition").Bind(positions).Text("Right")
</div>
 
@(Html.C1().FlexChart<FlexChartData.Sale>().Id("theChart")
    .Bind("Country", Model)
    .Series(sb =>
    {
        sb.Add().Binding("Sales").Name("Sales");
        sb.Add().Binding("Expenses").Name("Expenses");
        sb.Add().Binding("Downloads").Name("Downloads");
    })
)