All Projects → fanthos → chartjs-chart-timeline

fanthos / chartjs-chart-timeline

Licence: BSD-2-Clause license
Google-like timeline chart for Chart.js.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to chartjs-chart-timeline

jquery-linechart
JQuery plugin for creating charts
Stars: ✭ 42 (-4.55%)
Mutual labels:  chart, timeline
chart
📊📉 Add beautiful and reusable charts with one line of ruby for Rails 5.x
Stars: ✭ 42 (-4.55%)
Mutual labels:  chart, chartjs
Chartkick.py
Create beautiful Javascript charts with minimal code
Stars: ✭ 695 (+1479.55%)
Mutual labels:  chart, chartjs
Vue Chartjs
📊 Vue.js wrapper for Chart.js
Stars: ✭ 4,554 (+10250%)
Mutual labels:  chart, chartjs
Django Jchart
📈 A Django package for plotting charts using the excellent Chart.JS library.
Stars: ✭ 115 (+161.36%)
Mutual labels:  chart, chartjs
Chart
Quick & smart charting for STDIN
Stars: ✭ 521 (+1084.09%)
Mutual labels:  chart, chartjs
Scale
Angular plugin for creating charts
Stars: ✭ 39 (-11.36%)
Mutual labels:  chart, timeline
D3 Timeline
A simple D3 Timeline chart
Stars: ✭ 743 (+1588.64%)
Mutual labels:  chart, timeline
Chart.qml
Chart.qml like Chart.js
Stars: ✭ 100 (+127.27%)
Mutual labels:  chart, chartjs
Chartjs Chart Box And Violin Plot
Chart.js Box Plot addon
Stars: ✭ 91 (+106.82%)
Mutual labels:  chart, chartjs
Laravel Chartjs
Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library
Stars: ✭ 404 (+818.18%)
Mutual labels:  chart, chartjs
chartjs-plugin-datasource-prometheus
Chart.js plugin for Prometheus data loading
Stars: ✭ 77 (+75%)
Mutual labels:  chart, chartjs
React Chartjs 2
React components for Chart.js, the most popular charting library
Stars: ✭ 4,667 (+10506.82%)
Mutual labels:  chart, chartjs
Vis Timeline
📈 Create a fully customizable, interactive timelines and 2d-graphs with items and ranges.
Stars: ✭ 654 (+1386.36%)
Mutual labels:  chart, timeline
flame-chart-js
Component for incredibly fast viewing of flame charts
Stars: ✭ 28 (-36.36%)
Mutual labels:  chart, timeline
Go Chartjs
golang library to make https://chartjs.org/ plots (this is vanilla #golang, not gopherjs)
Stars: ✭ 42 (-4.55%)
Mutual labels:  chart, chartjs
Timeline Plus
Timeline - chronological visualization of your data
Stars: ✭ 140 (+218.18%)
Mutual labels:  chart, timeline
Chart.js-Rounded-Bar-Charts
Rounded Rectangles in Bar Charts
Stars: ✭ 48 (+9.09%)
Mutual labels:  chart, chartjs
Customizable-Crypto-Currency-Dashboard-with-Chart
📺 A Dashboard with the price movements of the selected Cryptocurrencies 💹
Stars: ✭ 79 (+79.55%)
Mutual labels:  chart
chartkick
Create beautiful JavaScript charts with one line of Clojure
Stars: ✭ 22 (-50%)
Mutual labels:  chart

chartjs-chart-timeline

Timeline chart library for Chart.js.

import Chart from 'chart.js';

"type": "timeline",
"options": {
    // Depricated and will be removed in future. Please use elements.* instead.
    // "colorFunction": function(text, data, dataset, index) {
    //     return Chart.helpers.color('black');
    // },
    // "showText": true,
    // "textPadding": 4
    "elements": {
        "colorFunction": function(text, data, dataset, index) {
            return Chart.helpers.color('black');
            // return '#black'; supported in 0.4.0
        },
        "showText": true,
        "textPadding": 4
    }
},
"data": {
    "labels": [
        "Cool Graph",
        "heater1"
    ],
    "datasets": [
        {
            "data": [
                [
                    "2018-01-22T16:00:00.000Z",
                    "2018-01-23T05:40:44.626Z",
                    "Unknown"
                ]
            ]
        },
        {
            "data": [
                [
                    "2018-01-22T16:00:00.000Z",
                    "2018-01-23T04:57:43.736Z",
                    "On"
                ],
                [
                    "2018-01-23T04:57:43.736Z",
                    "2018-01-23T04:57:55.437Z",
                    "Off"
                ],
                [
                    "2018-01-23T04:57:55.437Z",
                    "2018-01-23T05:40:44.626Z",
                    "On"
                ]
            ]
        }
    ]
},

Example for dynamic resize by dataset count:

resizeChart() {
    if (!this._chart) return;
    // Chart not ready
    if (this.$.chartTarget.clientWidth === 0) {
        if (this._resizeTimer === undefined) {
            this._resizeTimer = setInterval(this.resizeChart.bind(this), 10);
            return;
        }
    }

    clearInterval(this._resizeTimer);
    this._resizeTimer = undefined;

    this._resizeChart();
}

_resizeChart() {
    const chartTarget = this.$.chartTarget;

    const options = this.data;
    const data = options.data;

    if (data.datasets.length === 0) {
        return;
    }

    if (!this.isTimeline) {
        this._chart.resize();
        return;
    }

    // Recalculate chart height for Timeline chart
    var axis = this._chart.boxes.filter(x => x.position === 'bottom')[0];
    if (axis && axis.height > 0) {
        this._axisHeight = axis.height;
    }
    if (!this._axisHeight) {
        chartTarget.style.height = '100px';
        chartTarget.height = '100px';
        this._chart.resize();
        axis = this._chart.boxes.filter(x => x.position === 'bottom')[0];
        if (axis && axis.height > 0) {
            this._axisHeight = axis.height;
        }
    }
    if (this._axisHeight) {
        const cnt = data.datasets.length;
        const targetHeight = ((30 * cnt) + this._axisHeight) + 'px';
        if (chartTarget.style.height !== targetHeight) {
            chartTarget.style.height = targetHeight;
            chartTarget.height = targetHeight;
        }
        this._chart.resize();
    }
}

Usage: https://github.com/fanthos/chartjs-chart-timeline/wiki

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].