第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

無(wú)法將數(shù)組值輸入到圖表中

無(wú)法將數(shù)組值輸入到圖表中

繁星淼淼 2023-09-28 15:50:08
我正在使用 Rgraph 來(lái)繪制折線圖。我正在嘗試使用 Javascript 將值輸入到圖表中。這是例行公事..        function update_day_temp(newval){        var newval = '6,5,7,3,7,9,10';        var dta = [];        dta = newval.split(',');        console.log('data ' + dta);                day_temp = new RGraph.Line({            id: 'day_temp',//          data: dta,            data: [6,5,7,3,7,9,10],            options: {            }        }).draw()    };如果我使用使用過(guò)的數(shù)據(jù),一切都很好。但如果我使用 dta 那么我確實(shí)會(huì)得到結(jié)果。
查看完整描述

1 回答

?
海綿寶寶撒

TA貢獻(xiàn)1809條經(jīng)驗(yàn) 獲得超8個(gè)贊

添加我之前的評(píng)論后,我一直在玩這個(gè),你也可以這樣做(這已經(jīng)滿足了):

data: '6,5,7,3,7,9,10'.split(','),

這只是將字符串拆分為數(shù)組,然后通過(guò) RGraph 將值轉(zhuǎn)換為數(shù)字。

在 RGraph 的下一個(gè)版本 (v5.27) 中,您將不需要調(diào)用 split()。

這里有一個(gè)演示,它對(duì)數(shù)據(jù)調(diào)用 split() 函數(shù):

https://www.rgraph.net/demos/bar-basic.html

其代碼是這樣的:

new RGraph.Bar({

    id: 'cvs',

    data: '12,18,10,9,6,20,18'.split(','),

    options: {

        yaxisScaleUnitsPost: 'k',

        colors: ['red'],

        title: 'A basic Bar chart using accessible text',

        titleBold: true,

        xaxis: false,

        yaxis: false,

        marginLeft: 50,

        tooltips: '%{key}',

        tooltipsFormattedUnitsPost: '%',

        tooltipsCss: {

            fontSize: '26pt'

        },

        tooltipsFormattedKeyLabels: ['Dave','John'],

        tooltipsEvent: 'mousemove'

    }

}).draw().responsive([

    {maxWidth:900,width:400,height:150,options: {textSize:10,xaxisLabels:['Mon\n(yuck!)','Tue','Wed','Thu','Fri\n(woo!)','Sat','Sun'],marginInner: 10}},

    {maxWidth:null,width:750,height:250,options: {textSize:14,xaxisLabels: ['Monday\n(yuck!)','Tuesday','Wednesday','Thursday','Friday\n(woo!)','Saturday','Sunday'],marginInner: 20}}

]);


查看完整回答
反對(duì) 回復(fù) 2023-09-28
  • 1 回答
  • 0 關(guān)注
  • 110 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)