anychart.onDocumentReady(function() {
// chart type
var chart = anychart.radar();
// chart title
chart.title().text('Spending');
// series type and data set
chart.line([
{x: "Administration", value:"22"},
{x: "Sales", value:"34"},
{x: "Marketing", value:"16"},
{x: "Research", value:"12"},
{x: "Support", value:"38"},
{x: "Development", value:"47"}
]);
// draw chart
chart.container('container').draw();
});
我尝试添加fill
,但它似乎无法正常工作
chart.line([
{x: "Administration", value:"22", fill: "#color-code"},
{x: "Sales", value:"34", fill: "#color-code"},
{x: "Marketing", value:"16", fill: "#color-code"},
{x: "Research", value:"12", fill: "#color-code"},
{x: "Support", value:"38", fill: "#color-code"},
{x: "Development", value:"47", fill: "#color-code"}
]);
答案 0 :(得分:1)
这是雷达图上的一系列线,如Radar Plot: Line所述。 因此它遵循Line Chart系列设置:您需要设置Stroke,而不是填充,例如:
line = chart.line([
{x: "Administration", value:"22"},
{x: "Sales", value:"34"},
{x: "Marketing", value:"16"},
{x: "Research", value:"12"},
{x: "Support", value:"38"},
{x: "Development", value:"47"}
]);
line.stroke('red 3', 2, 2);
如Radar Line Chart with Stroke Settings Sample所示:
chart.palette(["Black", "Green"]);
或者,如果您需要多个不同的行,则可以使用AnyChart Palette:AnyChart Palette Multiple Lines Radar Chart
以下是基本样本的片段:
anychart.onDocumentReady(function() {
// chart type
var chart = anychart.radar();
// chart title
chart.title().text('Spending');
// set palette
chart.palette(["Black", "Green"]);
// series type and data set
chart.line([
{x: "Administration", value:"22"},
{x: "Sales", value:"34"},
{x: "Marketing", value:"16"},
{x: "Research", value:"12"},
{x: "Support", value:"38"},
{x: "Development", value:"47"}
]);
// series type and data set
chart.line([
{x: "Administration", value:"32"},
{x: "Sales", value:"44"},
{x: "Marketing", value:"46"},
{x: "Research", value:"42"},
{x: "Support", value:"48"},
{x: "Development", value:"57"}
]);
// draw chart
chart.container('container').draw();
});

html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}

<script src="https://cdn.anychart.com/releases/8.2.1/js/anychart-bundle.min.js"></script>
<div id="container"></div>
&#13;