问题
I'm trying to add title to the first graph in a multiple stock graphs list. But it doesn't show up. Here is the code:
stockGraphs: [{
id: "g1",
valueField: "value",
comparable: true,
bullet: "round",
valueAxis: [
{
title: "t1"
}]
}]
Here is a demo
回答1:
As indicated in the documentation, the valueAxis
property takes an id or a reference to the valueAxis object. You're trying to assign an array, which is way off.
You need to add an id
to the valueAxes
array inside your panel in your demo, then set the valueAxis
property to the id as a string:
valueAxes: [
{
id: "t1",
title: "t1",
maximum: 3000
},{
id: "t2",
title: "t1",
position: "right",
maximum: 3000
}
],
stockGraphs: [
{
id: "g1",
valueField: "value",
comparable: true,
bullet: "round",
valueAxis: "t1"
},{
id: "g2",
valueField: "value2dataset1",
comparable: true,
bullet: "round",
valueAxis: "t2"
}
],
Demo
I added a second value axis as assigning a value axis to a graph only helps if you need to display multiple value axes in a panel as all graphs will use the first value axis by default if it is not assigned.
来源:https://stackoverflow.com/questions/47668623/unable-add-valueaxis-property-to-amchart-stock-graph