Sumber daya yang dimuat... Pemuatan...

Opsi grafik

JSON ini digunakan untuk mengatur informasi konfigurasi grafik dari fungsi gambar khususChart(). Perpustakaan grafik yang digunakan adalah Highcharts. Hanya beberapa bidang konfigurasi dasar yang terdaftar di sini.

Lapangan ekstensi platform. diatur ke benar untuk menggunakan grafik Highstocks; diatur ke salah untuk menggunakan grafik Highcharts.

__isStock string

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

perpanjangan JSON Judul grafik Judul string Konfigurasi sumbu X. xAxis JSON Konfigurasi sumbu Y. yAxis JSON Seri data grafik. seri JSON

Contoh gambar sederhana:

// 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-opsi