Sumber dimuat naik... memuat...

Pilihan carta

JSON ini digunakan untuk menetapkan maklumat konfigurasi carta fungsi lukisan tersuaiChart(). Perpustakaan carta yang digunakan adalah Highcharts. Hanya beberapa medan konfigurasi asas disenaraikan di sini.

Lapangan pelanjutan platform. Tetapkan ke benar untuk menggunakan carta Highstocks; tetapkan ke salah untuk menggunakan carta Highcharts.

__isStock senar

{
    layout: 'single', // Not participating in grouping, displayed separately, default is group 'group'
    height: 300,      // Specify height
}

Pelancongan JSON Judul carta tajuk senar Konfigurasi paksi X. xAxis JSON Konfigurasi paksi Y. yAxis JSON Siri data carta. siri JSON

Contoh lukisan mudah:

// This chart is an object in JavaScript language. Before using the Chart function, we need to declare an object variable chart to configure the chart.
var chart = {                                           
    // This field marks whether the chart is a general chart. If you are interested, you can change it to false and run it.
    __isStock: true,                                    
    // Zoom tool
    tooltip: {xDateFormat: '%Y-%m-%d %H:%M:%S, %A'},    
    // title
    title : { text : 'Price difference analysis chart'},                       
    // Select range
    rangeSelector: {                                    
        buttons:  [{type: 'hour',count: 1, text: '1h'}, {type: 'hour',count: 3, text: '3h'}, {type: 'hour', count: 8, text: '8h'}, {type: 'all',text: 'All'}],
        selected: 0,
        inputEnabled: false
    },
    // The horizontal axis of the coordinate axis is: x-axis, and the current setting type is: time
    xAxis: { type: 'datetime'},                         
    // The vertical axis of the coordinate axis is: the y-axis, the default value is adjusted according to the data size
    yAxis : {                                           
        // title
        title: {text: 'Price difference'},                           
        // Whether to enable the right vertical axis
        opposite: false                                 
    },
    // Data series, this property saves each data series (line, K-line chart, label, etc.)
    series : [                                          
        // The index is 0, and the data array stores the data of the index series.
        {name : "line1", id : "line 1,buy1Price", data : []},                          
        // The index is 1, dashStyle:'shortdash' is set, that is, a dashed line is set
        {name : "line2", id : "line 2,lastPrice", dashStyle : 'shortdash', data : []}  
    ]
}
function main(){
    // Call the Chart function to initialize the chart
    var ObjChart = Chart(chart)         
    // Clear
    ObjChart.reset()                      
    while(true){
        // Get the timestamp of this poll, which is a millisecond timestamp. Used to determine the position of the X-axis written to the chart
        var nowTime = new Date().getTime()
        // Get market data
        var ticker = _C(exchange.GetTicker)
        // Get the buy price from the return value of the market data
        var buy1Price = ticker.Buy    
        // Get the last transaction price. In order to prevent the two lines from overlapping, we add 1.
        var lastPrice = ticker.Last + 1
        // Use the timestamp as the X value and the buy price as the Y value to pass into the data sequence of index 0
        ObjChart.add(0, [nowTime, buy1Price])
        // Same as above
        ObjChart.add(1, [nowTime, lastPrice])
        Sleep(2000)
    }
}

{@fun/Log/Chart Chart}

LogStatus-btnTypeTwo KLineChart-pilihan