久久久久久久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?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 91国内精品久久 | 欧美日韩国产一区二区三区不卡 | 视频在线一区二区 | 亚洲国产精品一区二区第一页 | 日韩在线91 | 黑人精品| 最新国产在线 | 久久一区二区三区电影 | 久久精品aaa | 精品久久99 | 日韩视频免费 | 一区二区视频在线观看 | 国产精品久久久久久久免费大片 | 日韩精品专区在线影院重磅 | 成人精品视频在线观看 | 精品久久久久久亚洲精品 | 99精品国自产在线观看 | 国产一区二区日韩 | 中文字幕专区 | 91视视频在线观看入口直接观看 | 久久久免费精品 | 国产免国产免费 | 国产第二页| 97日韩精品 | 成人午夜免费福利视频 | av毛片| 国产一区欧美 | 欧美日韩在线一区二区三区 | 国产一区二区三区在线 | 欧美精品在线一区二区三区 | 国产一区二区中文字幕 | 精品国产网 | 精品一区二区三区四区五区 | 在线三级网址 | 国产精品久久欧美久久一区 | 中文字幕免费视频 | 超碰欧美| 欧美成人精品一区二区男人看 | 操久久| av一区在线 | 91亚洲精选 |