ドキュメントは、おそらくどのようbaseValue
作品に明確ではありません。 baseValue
は、「ゼロライン」を再定義するために使用されます。つまり、エリアグラフの塗りつぶしがその値に移動し、列がその値から開始します。軸のスケールまたは最小/最大とは関係ありません。
:チャートは自動的に値がすべて正であるならば、あなたはそのように、あなたのデータ値をチェックして、前のチャートの初期化に適切なように、最小を設定する
AmCharts.addInitHandler
を使用してミニプラグインを作成することができ、ゼロから始めるようにするに
// Mini plugin to force a zero minimum on the first value axis if all values
// are non-negative. Can be extended to support multiple value axes if needed.
AmCharts.addInitHandler(function(chart) {
//get all value fields if there are multiple graphs
var valueFields = chart.graphs.map(function(graph) {
return graph.valueField;
});
//find out if there are any negative values in the dataProvider for any graph.
var containsNegatives = chart.dataProvider.some(function(dataItem) {
return valueFields.some(function(valueField) {
return dataItem[valueField] < 0;
});
});
//only set the value axis minimum to 0 if there are no negatives.
if (!containsNegatives) {
chart.valueAxes[0].minimum = 0;
chart.validateData();
}
}, ['serial']);
an updated fiddleは、2つのチャートを使用してこれを示しています。