久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

C3.js - 時間序列無法解析

C3.js - Timeseries with time fails to parse(C3.js - 時間序列無法解析)
本文介紹了C3.js - 時間序列無法解析的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想使用 2015-09-17 18:20:34 格式的日期和格式字符串 C3.js 顯示時間序列圖code>'%Y-%m-%d %H:%M:%S' 但解析失敗.

I want to display a time series chart with C3.js using a date in the format 2015-09-17 18:20:34 and the format string '%Y-%m-%d %H:%M:%S' but it fails to parse.

我的代碼:

var chart = c3.generate({
    bindto: '#chart',
    data: {
      x: 'times',
      columns: [
        ['times','2015-09-17 18:20:34','2015-09-17 18:25:42','2015-09-17 18:30:48'],
        ['data','1539','1546','1546','1550']
      ]
    },
    axis: {
        x: {
            type: 'timeseries',
            tick: {
                format: '%Y-%m-%d %H:%M:%S'
            }
        }
    }
});

我收到以下錯誤:

02:26:44.889 Failed to parse x '2015-09-17 18:20:34' to Date object c3.min.js:1:21943
02:26:44.889 Failed to parse x '2015-09-17 18:25:42' to Date object c3.min.js:1:21943
02:26:44.890 Failed to parse x '2015-09-17 18:30:48' to Date object c3.min.js:1:21943
02:26:44.890 Failed to parse x '2015-09-17 18:20:34' to Date object c3.min.js:1:21943
02:26:44.891 Failed to parse x '2015-09-17 18:25:42' to Date object c3.min.js:1:21943
02:26:44.892 Failed to parse x '2015-09-17 18:30:48' to Date object c3.min.js:1:21943

如果我在數據和格式中省略時間,它會起作用,但我也需要時間.

It works if I omit the time in the data and in the format but I need the time, too.

推薦答案

我找到了解決問題的方法:

I found the solution to my problem:

axis 對象中的格式只是定義日期的顯示方式.如果要指定日期解析的格式,則必須在 data 對象中使用 xFormat.

The format in the axis object is just to define how the date will be displayed. If you want to specify the format for the date parsing you have to use xFormat in the data object.

var chart = c3.generate({
    bindto: '#chart',
    data: {
      x: 'times',
      xFormat: '%Y-%m-%d %H:%M:%S', // how the date is parsed
      columns: [
        ['times','2015-09-17 18:20:34','2015-09-17 18:25:42','2015-09-17 18:30:48'],
        ['data','1539','1546','1546','1550']
      ]
    },
    axis: {
        x: {
            type: 'timeseries',
            tick: {
                format: '%Y-%m-%d %H:%M:%S' // how the date is displayed
            }
        }
    }
});

這篇關于C3.js - 時間序列無法解析的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 午夜精品一区 | 丁香综合 | 久在线观看 | 国产一区二区三区四区五区3d | 午夜精品一区二区三区免费视频 | 日日夜夜天天久久 | 成人欧美一区二区三区 | 国产成人综合亚洲欧美94在线 | 亚洲精品久久久久久久久久久 | 性福视频在线观看 | 国产在线观看网站 | 国产精品久久久久久久岛一牛影视 | 亚卅毛片| 欧美成人一区二区 | 久久综合影院 | 欧美成人一级 | 亚洲乱码国产乱码精品精的特点 | 中文字幕免费中文 | 精品国产一区二区三区日日嗨 | 国产免费又黄又爽又刺激蜜月al | 搞av.com | 在线观看国产wwwa级羞羞视频 | 日本一区二区三区四区 | 成人免费大片黄在线播放 | 国内精品视频 | 成人中文字幕在线 | 欧美成人免费在线 | 日日天天 | 欧美中文字幕一区二区三区亚洲 | 玖草资源 | 久久美女网 | 午夜寂寞影院在线观看 | 国产在线视频在线观看 | 成人亚洲性情网站www在线观看 | 成人精品在线观看 | 91在线观看视频 | 精品久久影院 | caoporn国产 | jizz在线免费观看 | 欧美国产日韩在线观看 | 久久黄色网 |