總覽函數
在AnyChart中,您能夠經過切換軸的方向以垂直方向繪製圖表。大多數類型的系列都支持此功能-請參閱「 支持的類型」部分。url
本文介紹瞭如何建立垂直圖表以及如何動態更改圖表的方向。spa
快速開始.net
要建立垂直圖表,請使用如下三個圖表構造函數之一:blog
- anychart.vertical()
- anychart.verticalArea()
- anychart.verticalLine()
- anychart.bar()
它們之間沒有本質區別:它們只是切換軸的方向,垂直繪製X軸,水平繪製Y軸。v8
您能夠將數據傳遞到圖表構造函數以建立一系列相同類型的數據。或者,您能夠手動指定系列類型。若是系列的類具備isVertical()方法,則該系列支持垂直方向。例如,這是Line系列的isVertical()方法。您還能夠查看本文的「 支持的類型」部分。get
在下面的示例中,由splineArea()和spline()方法建立了兩個系列,即Spline Area和Spline,圖表構造函數爲anychart.vertical():it
// create a data set var data = anychart.data.set([ ["January", 10000, 12500], ["February", 12000, 15000], ["March", 13000, 16500], ["April", 10000, 13000], ["May", 9000, 11000] ]); // map the data var seriesData_1 = data.mapAs({x: 0, value: 1}); var seriesData_2 = data.mapAs({x: 0, value: 2}); // create a chart chart = anychart.vertical(); // create the first series (bar) var series1 = chart.splineArea(seriesData_1); // create the second series (spline) var series2 = chart.spline(seriesData_2); // set the container id chart.container("container"); // initiate drawing the chart chart.draw();
即時切換io
系列class
建立序列後,能夠經過調用isVertical()方法並將其參數設置爲trueor 來即時更改其方向false(例如,這是Line系列的isVertical()方法)。
注意:此設置僅影響系列,而不影響軸。
在如下示例中,此方法用於在同一圖表上繪製兩個水平(區域)和垂直(條形)序列:
// create a chart chart = anychart.area(); // create the first series var series1 = chart.area(seriesData_1); // create the second series var series2 = chart.area(seriesData_2); // create the third series var series2 = chart.column(seriesData_3); // change the orientation of the third series to vertical chart.getSeriesAt(2).isVertical(true);
圖表
要使用基本的笛卡爾圖表即時切換整個圖表的方向,您能夠簡單地使用isVertical()方法。
// create a chart chart = anychart.line(); // change the orientation of the chart chart.isVertical(true);
注意:要旋轉像Mekko或Mosaic之類的圖表,您應該一個接一個地旋轉和與軸。所以,請使用isVertical()方法和orientation()方法。
支持的類型
如下是受支持的垂直圖表的列表:
- 條形(垂直列)
- 範圍欄(垂直列)
- 垂直面積
- 立式吧檯
- 立式盒
- 垂直氣泡
- 立式日本燭臺
- 垂直跳線
- 垂直HiLo
- 垂線
- 垂直標記
- 垂直梅科
- 垂直馬賽克
- 垂直OHLC
- 垂直範圍
- 垂直範圍樣條區域
- 垂直範圍步進面積
- 垂直花鍵
- 垂直花鍵面積
- 垂直臺階面積
- 垂直階梯線
- 立杆