2017-08-16 97 views
0

我使用amchart stock chart繪製線在K線圖上amchart

function createStockChart() { 
    var chart = new AmCharts.AmStockChart(); 
    var dataSet = new AmCharts.DataSet(); 

    // make candlechart 

    dataSet.fieldMappings = [{ 
     fromField: "open", 
     toField: "open" 
    }, { 
     fromField: "close", 
     toField: "close" 
    }, { 
     fromField: "high", 
     toField: "high" 
    }, { 
     fromField: "low", 
     toField: "low" 
    }, { 
     fromField: "volume", 
     toField: "volume" 
    }, { 
     fromField: "testValue", 
     toField: "testValue" 
    }]; 
    dataSet.dataProvider = chartData; 
    dataSet.categoryField = "date"; 


// make line to be drawn on the candle stock 

    var dataSet2 = new AmCharts.DataSet(); 
    dataSet2.fieldMappings = [{ 
     fromField: "close", 
     toField: "value" 
    }]; 
    dataSet2.color = "#33888a"; 
    dataSet2.dataProvider = chartData; 
    dataSet2.compared = false; // if I made here true, the line appears but it will be shown as percentage!!. 
    dataSet2.title = "Open"; 
    dataSet2.categoryField = "date"; 

我想提請在K線圖線。

如果我使用true作爲compared字段,則該線出現在蠟燭部分上方,但Y軸轉到百分比。

這是正確的,因爲它是比較功能。

但是我想追加圖表,而不是爲了比較。

我怎樣才能在蠟燭圖上簡單畫一條線?

回答