Search results

Legend

As like a chart, the legend is also available for accumulation charts, which gives information about the points. By default, the legend will be placed on the right, if the width of the chart is high or will be placed on the bottom, if the height of the chart is high. Other customization features regarding the legend element are same as the chart legend. Here, the legend for a point can be collapsed by giving the empty string to the x value of the point.

tagHelper
default.cs
@section ControlsSection{
      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
            <e-accumulationchart-legendsettings visible="true">
            </e-accumulationchart-legendsettings>
            <e-accumulation-series-collection>
                <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                </e-accumulation-series>
            </e-accumulation-series-collection>
        </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Position and Alignment

By using the position property, you can position the legend at the leftrighttop or bottom of the chart. You can also align the legend to centerfar or near of the chart using the alignment property.

tagHelper
position.cs
@section ControlsSection{
      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
            <e-accumulationchart-legendsettings visible="true" position="Top">
            </e-accumulationchart-legendsettings>
            <e-accumulation-series-collection>
                <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                </e-accumulation-series>
            </e-accumulation-series-collection>
        </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Legend Shape

To change the legend icon shape, use the legendShape property in the series. By default, legend icon shape is seriesType.

tagHelper
legend-shape.cs
@section ControlsSection{
      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
            <e-accumulationchart-legendsettings visible="true">
            </e-accumulationchart-legendsettings>
            <e-accumulation-series-collection>
                <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser"
                 legendShape="Rectangle">
                </e-accumulation-series>
            </e-accumulation-series-collection>
        </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Legend Size

The legend size can be changed by using the width and height properties of the legendSettings.

tagHelper
size.cs
@section ControlsSection{
      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="true" height="28%" width="44%" >
                        <e-legendsettings-border color="pink" width="1"></e-legendsettings-border>
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Legend Item Size

You can customize the size of the legend items by using the shapeHeight and shapeWidth properties.

tagHelper
item-size.cs
@section ControlsSection{
      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
            <e-accumulationchart-legendsettings visible="true" shapeHeight="15" shapeWidth="15">
            </e-accumulationchart-legendsettings>
            <e-accumulation-series-collection>
                <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                </e-accumulation-series>
            </e-accumulation-series-collection>
        </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Paging for Legend

Paging will be enabled by default, when the legend items exceeds the legend bounds. You can view the each legend item by navigating between the pages using the navigation buttons.

tagHelper
paging.cs
@section ControlsSection{
                      <ejs-accumulationchart id="container" title="Mobile Browser Statistics">
                    <e-accumulationchart-legendsettings visible="true" height="150" width="80">
                    </e-accumulationchart-legendsettings>
                    <e-accumulation-series-collection>
                        <e-accumulation-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" name="Browser">
                        </e-accumulation-series>
                    </e-accumulation-series-collection>
                </ejs-accumulationchart>
 }
public ActionResult Index()
        {
            List<PieChartData> chartData = new List<PieChartData>
            {

                new PieChartData { xValue = "Chrome", yValue = 37 },
                new PieChartData { xValue = "UC Browser", yValue = 17 },
                new PieChartData { xValue = "iPhone", yValue = 19 },
                new PieChartData { xValue = "Others", yValue = 4  },
                new PieChartData { xValue = "Opera", yValue = 11 },
                new PieChartData { xValue = "Android", yValue = 12 },
            };
            ViewBag.dataSource = chartData;
            return View();
        }
        public class PieChartData
        {
            public string xValue;
            public double yValue;
        }

Enable Animation

You can customize the animation while clicking legend by setting enableAnimation as true or false using enableAnimation property in Accumulation Chart.