如何更改 dxChart 中的图例符号
How to change legend symbol in dxChart
我看过DevExpress的文档,但我找不到改变图例符号的方法。
有人可以帮我吗?
JS :
var dataSource = [{
country: "USA",
hydro: 59.8,
}, {
country: "China",
hydro: 74.2,
}, {
country: "Russia",
hydro: 40,
}, {
country: "Japan",
hydro: 22.6,
}, {
country: "India",
hydro: 19,
}, {
country: "Germany",
hydro: 6.1,
}];
var chart = $("#chart").dxChart({
dataSource: dataSource,
commonSeriesSettings: {
argumentField: "country",
type: 'line'
},
margin: {
bottom: 20
},
argumentAxis: {
valueMarginsEnabled: false,
discreteAxisDivisionMode: "crossLabels",
grid: {
visible: true
}
},
series: [
{ valueField: "hydro", name: "Hydro-electric" }
],
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center",
itemTextPosition: "bottom"
},
title: {
text: "Energy Consumption in 2004",
}
})
HTML :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="chart-demo">
<div id="chart"></div>
</div>
</div>
</body>
</html>
输出:
在上面的示例中,图例符号默认为 "square"。
我需要从 "square" 更改为 "cross"。
遗憾的是,无法更改 dxChart 中的默认图例项目符号。
我看过DevExpress的文档,但我找不到改变图例符号的方法。
有人可以帮我吗?
JS :
var dataSource = [{
country: "USA",
hydro: 59.8,
}, {
country: "China",
hydro: 74.2,
}, {
country: "Russia",
hydro: 40,
}, {
country: "Japan",
hydro: 22.6,
}, {
country: "India",
hydro: 19,
}, {
country: "Germany",
hydro: 6.1,
}];
var chart = $("#chart").dxChart({
dataSource: dataSource,
commonSeriesSettings: {
argumentField: "country",
type: 'line'
},
margin: {
bottom: 20
},
argumentAxis: {
valueMarginsEnabled: false,
discreteAxisDivisionMode: "crossLabels",
grid: {
visible: true
}
},
series: [
{ valueField: "hydro", name: "Hydro-electric" }
],
legend: {
verticalAlignment: "bottom",
horizontalAlignment: "center",
itemTextPosition: "bottom"
},
title: {
text: "Energy Consumption in 2004",
}
})
HTML :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="chart-demo">
<div id="chart"></div>
</div>
</div>
</body>
</html>
输出:
在上面的示例中,图例符号默认为 "square"。 我需要从 "square" 更改为 "cross"。
遗憾的是,无法更改 dxChart 中的默认图例项目符号。