chart.js

How to Add X axis Padding in chart js Line Graph

邮差的信 提交于 2019-12-25 08:23:21
问题 I drawn a Line graph using chart js. it works well but problem is it will start all the lines from 0 but i need some padding between graph line and axis line it. I need like I need this Gap ( Red Marked ). How can i achieve this?? 回答1: From the fiddle you provided, A tricky way will be to push in $scope.labels and $scope.data a null in first position: $scope.labels.unshift(''); $scope.data[0].unshift(null); $scope.data[1].unshift(null); A start you had: And you will have: 来源: https:/

React render function preventing creating new canvas element on each time invoked - Charts.js

倖福魔咒の 提交于 2019-12-25 08:04:13
问题 I am using React, Charts.js and react-chart.js. I am making an API request which returns data that i am then visualizing. The problem I am having is that when the page initially loads it only displays one of the names, an then it renders again and the complete list of three names is shown. The problem is that a new graph is created each time the render function is invoked. Does anyone know if there is a way to prevent a new graph being created each time, but instead to overwrite the previous

Chart.js will not render using vue.js until window resizes

半世苍凉 提交于 2019-12-25 07:18:51
问题 I have a simple app that uses Bootstrap, vue.js, and chart.js. The HTML template is pretty simple. I've noticed while searching for my error that this issue is often caused when trying to render a chart in a tab or modal but I don't have my chart in a modal or tab. As soon as a I resize my browser window, the chart renders properly and scales to fit the div and everything. For whatever reason, when the page first loads, the canvas HTML tag renders like this: <canvas id="graph" width="0"

Combine chart.js bar and line charts with differing granularity

旧巷老猫 提交于 2019-12-25 06:21:14
问题 The following HTML page generates a combined bar and line chart: <html> <head> <title>Combo Bar-Line Chart</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.bundle.js"></script> <style> canvas { -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } </style> </head> <body> <div style="width: 800px"> <canvas id="canvas"></canvas> </div> <script> var

Angular 2 & ng2-charts: (SystemJS) Unexpected directive 'BaseChartComponent' imported

依然范特西╮ 提交于 2019-12-25 04:57:04
问题 I am trying to get the ng2-charts module to work with my Angular 2 application using a Node.js back-end. This is my app.module.ts file import {NgModule} from "@angular/core"; import {BrowserModule} from "@angular/platform-browser"; import {FormsModule} from "@angular/forms"; import {HttpModule} from "@angular/http"; import AppComponent from "./app.component"; import TwitterService from "./twitter.service"; import BarGraphComponent from "./bar-graph.component"; import LineGraphComponent from "

ChartJS2 in Ionic2

依然范特西╮ 提交于 2019-12-25 04:28:17
问题 I have created a new project and tried to implement charts using ChartJS2 from this link app.module.ts ... import { ChartModule } from 'ng2-chartjs2'; @NgModule({ ... imports: [ ChartModule ], ... }) export class AppModule {} index.html <script src="../node_modules/chart.js/src/chart.js"></script> <!--<script src="node_modules/chart.js/src/chart.js"></script>--> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.min.js"></script>--> <!-- Tried all three --> home.ts .

showing undefined data in chart.js but showing array in inspect element

喜你入骨 提交于 2019-12-25 03:30:33
问题 I am trying to display total montly sales of a financial april to march of a year. I am using chart.js and codeigniter for this .. I have tried query in phpmyadmin , and giving me columns there, the same array is displaying in console log but when I run chartjs. It shows me undefined. Also I have written query for displaying last years data, but it is giving me one column of 2015, dont know how it is comming there. <<>> added edit- i tried google charts, morris charts, highcharts, charts.js,

Bar not showing Bar chart + chart js

穿精又带淫゛_ 提交于 2019-12-25 01:53:07
问题 I am trying to build a Bar chart with a dataset with both x & y axes as time units. But I'm not able to bring bar on the chart. Can someone please check this and assist what am I doing wrong. Here is the complete code. https://jsfiddle.net/sjabiulla/bkqpdjue/4/ Here is my js. var chartData = { datasets: [ { type: 'bar', label: 'Last Year', backgroundColor: 'yellow', borderColor: 'white', fill:true, data: [ { x: '2017-01-06 00:00:00', y: '2017-01-06 04:15:30' }, { x: '2017-01-07 00:00:00', y:

ChartJS shows up and disappears

南楼画角 提交于 2019-12-25 00:26:20
问题 So I am using ChartJS alongside a Bootstrap 4 and Laravel Project. The code is fine(see below). Every time I refresh the page, the chart shows up for like a millisecond and goes away. <div class="col-md-6"> <div> <canvas id="pie-chart" style="width:100%;"></canvas> <!-- Pie Chart --> <script> new Chart(document.getElementById("pie-chart"), { type: 'pie', data: { labels: ["College Project", "Mind Map", "Designers Club"], datasets: [{ label: "Population (millions)", backgroundColor: ["#3e95cd",

How to implement doughnut ChartJS with CodeIgniter 3 and display data from database

牧云@^-^@ 提交于 2019-12-24 21:10:01
问题 I've been trying to get doughnut chart to work with my CI3 application to no avail as this is my first time trying ChartJS out. What I tried -PHP public function get( $data ) { if ( $this->input->is_ajax_request() ) { $this->load->library('user_utils'); if ( $data == 'subscriptions' ) { $this->load->model('Fetcher', 'fetcher'); $options = [ // Database specific key/value pairs ]; $fetch = $this->fetcher->fetch( 'where', $options ); if ( $fetch ) { echo json_encode( $fetch->result_array() ); /