legend border

Specifies legend border options.

Type: Object

Use this object to make a legend's border visible/invisible and set up such border options as color, width etc.

Show Example:
jQuery

This example shows how to customize the appearance of the legend border.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                color: 'lightskyblue',
                cornerRadius: 20,
                opacity: 0.5,
                width: 2
            }
        }
    });
});

color

Specifies border color.

Type: String
Default Value: '#808080'

This option supports the following colors.

  • hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • predefined/cross-browser color names
  • predefined SVG colors (not supported in Internet Explorer 8)

To make the border visible, set the visible property to true.

Show Example:
jQuery

In this example, the color option of the legend border is set to lightseagreen.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                color: 'lightseagreen'
            }
        }
    });
});

cornerRadius

Specifies a radius of a border's corners in digrees.

Type: Number
Default Value: 0

Use this property to round a legend's border.

Show Example:
jQuery

In this example, the legend border's cornerRadius option is set to 15.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                cornerRadius: 15
            }
        }
    });
});

dashStyle

Specifies the border's dash style in the legend.

Type: String
Default Value: 'solid'
Accepted Values: 'solid'|any combination of 'longDash', 'dash', 'dot'

The following values are available:

  • solid
    Displays a solid, continuous line.
  • longDash
    Displays a border using long dashes.
  • dash
    Displays a border using dashes.
  • dot
    Displays a border using dots.
  • Any combination of 'longDash', 'dash' and 'dot'
    Displays a border by repeating the specified combination. For instance, 'dashdotdash'.
Show Example:
jQuery

In this example, the legend border's dash style is changed to longDashdot. The cornerRadius and width options are also changed.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                dashStyle: 'longDashdot',
                cornerRadius: 20,
                width: 2
            }
        }
    });
});

opacity

Specifies a border's opacity.

Type: Number
Default Value: 0.35

Show Example:
jQuery

In this example, the legend border's opacity option is set to 1.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                opacity: 1
            }
        }
    });
});

visible

Sets a legend's border visibility state.

Type: Boolean
Default Value: false
Accepted Values: true|false

Show Example:
jQuery

Use the check box at the bottom to change the visibility of the legend border.

<div id="pieChartContainer" style="height:400px; max-width:600px; margin: 0 auto"></div>
<div id="checkboxContainer" style="height:40px;width:200px;margin:5px auto;font-family:'Trebuchet MS',Arial,sans-serif;font-size:14px;text-align:center">
    <input type="checkbox" id="showLegendBorderCheckbox" checked> Show Legend Border
</div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: { visible: true }
        }
    });

    $('#showLegendBorderCheckbox').change(function () {
        var pieChart = $('#pieChartContainer').dxPieChart('instance');
        pieChart.option({
            legend: { border: { visible: this.checked } }
        });
    });
});

width

Specifies a border's width, in pixels.

Type: Number
Default Value: 1

Show Example:
jQuery

In this example, the legend border's width option is set to 3. The color and cornerRadius options are also changed.

<div id="pieChartContainer" style="height:400px;max-width:600px;margin: 0px auto"></div>
var dataSource = [
    { continent: 'Africa', population: 1022234000 },
    { continent: 'Antarctica', population: 4490 },
    { continent: 'Asia', population: 4164252000 },
    { continent: 'Australia', population: 29127000 },
    { continent: 'Europe', population: 738199000 },
    { continent: 'North America', population: 542056000 },
    { continent: 'South America', population: 392555000 }
];

$(function () {
    $("#pieChartContainer").dxPieChart({
        dataSource: dataSource,
        series: {
            argumentField: 'continent',
            valueField: 'population'
        },
        title: 'Population by Continent',
        legend: {
            border: {
                visible: true,
                width: 3,
                color: 'lightskyblue',
                cornerRadius: 20
            }
        }
    });
});