Code Monkey home page Code Monkey logo

chartjs's Introduction

chartjs

This repository contains code to create charts using ChartJS version 1.x.

If you are interested in getting the latest code using version 2.x then check the latest repository Click here

For tutorial notes Click here

YouTube playlist Click here

chartjs's People

Contributors

yusufshakeel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chartjs's Issues

One additional Request

Hi,

Is it possible to show an example for pie chart using php-mysql?

How to parse the json data to pie data in chart js?

Regards,
Diwahar S

Possible to Auto Update Chart?

Thanks for this awesome tutorial. I am fairly new to jquery and chartjs. I got my first chart working and it's awesome. If I wanted to update this chart every 60 seconds, how would I go about that?

Normally, I'd do something like:
setInterval(function(){
functionName();
}, 60000 );

But since this doesn't have a function name, it just does a document ready function, I am not sure what to do. Also, chartjs has an update function. I'd love to know how to utilize that.

The line graph is not displayed in chrome

I tried your code but the line graph is not displayed at all..
also the http://localhost/mysqlchartjs/followersdata.php file displays the content in a completely different way.
my chrome version is 50.

I tried in IE and mozilla firefox too still the same issue..
please help

it shows something like this -


( ! ) Warning: mysqli::mysqli(): (HY000/1044): Access denied for user ''@'localhost' to database 'reports' in C:\wamp\www\mysqlchartjs\followersdata.php on line 12
Call Stack
#TimeMemoryFunctionLocation
10.0018255096{main}( )..\followersdata.php:0
20.0020257672mysqli ( )..\followersdata.php:12

Possible addition to linegraph.js

Wondering if you would be able to help me with a setinterval function so the data can be dynamically updated with data that gets added to the database? I cannot figure out how to that function into your linegraph.js

Any help is appreciated!!

ChartJs Custom Tooltip is stucked on UI

Hi, I have included chart.js custom tooltip using example in official docs.

Problem:
If someone have mouse on chart then this custom tooltip is displayed. And while the mouse is in chart, if someone uses tabs/enter to navigate to another page, this custom tooltip function is not called. As a consequence, tooltip is not removed from UI in rest of the interactions with app. I have inspected the core library and I think it was only detecting mouseout event which in this case, didn't call this custom tooltip hook.

Below attached is my code for tooltip configuration, and I am using react-chartjs-2 wrapper to consume chart.js
Chart.js version: 2.9.1
react-chartjs-2: 2.8.0

tooltips: {
              enabled: false,
              placement: 'left',
              caretSize: 5,
              cornerRadius: 6,
              custom: function(tooltipModel) {
                let tooltipEl = document.getElementById('custom-tooltip');

                // Create element on first render
                if (!tooltipEl) {
                  tooltipEl = document.createElement('div');
                  tooltipEl.id = 'custom-tooltip';
                  document.body.appendChild(tooltipEl);
                }

                // Hide if no tooltip
                if (tooltipModel.opacity === 0) {
                  tooltipEl.style.opacity = 0;
                  return;
                }

                let position = this._chart.canvas.getBoundingClientRect();
                let clickPointPosition = position.left + window.pageXOffset + tooltipModel.caretX;
                // Display, position, and set styles for font
                tooltipEl.style.opacity = 0.9;
                tooltipEl.style.position = 'absolute';
                tooltipEl.style.left = (clickPointPosition < tooltipEl.offsetWidth ? clickPointPosition : clickPointPosition - tooltipEl.offsetWidth) + 'px';
                tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 'px';
                tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily;
                tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px';
                tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle;
                tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px';
                tooltipEl.style.pointerEvents = 'none';
              }
            },

multiple charts per one page

@yusufshakeel From your chartjs project I followed and it work pretty good. but I need to separate chart by records of json data. if I have 10 records it should be 10 charts per one page. How to do it ? Please share your code if it's possible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.