The resource loading... loading...

Chart-options

This JSON is used to set the chart configuration information of the custom drawing function Chart(). The chart library used is Highcharts. Only a few basic configuration fields are listed here.

Platform extension field. Set to true to use Highstocks charts; set to false to use Highcharts charts.

__isStock string

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

extension JSON Chart title title string X-axis configuration. xAxis JSON Y-axis configuration. yAxis JSON Chart data series. series JSON

A simple drawing example:

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