A plugin for the jQuery javascript library to generate small sparkline charts directly in the browser

Overview

jQuery Sparklines

This jQuery plugin makes it easy to generate a number of different types of sparklines directly in the browser, using online a line of two of HTML and Javascript.

The plugin has no dependencies other than jQuery and works with all modern browsers and also Internet Explorer 6 and later (excanvas is not required for IE support).

See the jQuery Sparkline project page for live examples and documentation.

License

Released under the New BSD License

(c) Splunk, Inc 2012

Comments
  • Bootstrap box-sizing causing tooltip issues

    Bootstrap box-sizing causing tooltip issues

    Globally setting box-sizing to border-box causes tooltip to be displayed incorrectly. This can be fixed by the following css after bootstrap. This may become an issue as box-sizing is more frequently used.

    .jqstooltip{
        box-sizing: content-box;
    }
    

    image

    bug 
    opened by chrisfraser 14
  • Distribution Script (jquery.sparkline.js)

    Distribution Script (jquery.sparkline.js)

    Can you available the distribution script (jquery.sparkline.js) on github? I use bower as dependency manager and he seeks scripts from github, which does not have the script in question. Thanks

    opened by brunobelarmino 13
  • Crossplatform build system

    Crossplatform build system

    What do you think about replacing build system based on makefile and shell commands with something cross-platform? I am mostly talking about Windows users who don't have these great tools.

    I know it is a big change in workflow but it has two advantages:

    1. It will be easier to contribute for windows users.
    2. Nowadays dependency management with NPM is really getting traction. It is especially usefull for big projects. There is jquery-sparkline package published on npmjs.com but is not possible to install it on windows due to the fact it tries to build from sources with make script.

    NPM itself may be a good candidate for the build tool because it has a way to explicitly specify tools as dependencies (no need to install uglify-js separately) and in general is convenient for javascript projects.

    What do you think regarding it?

    opened by 11bit 11
  • Add support for bower package manager

    Add support for bower package manager

    Also added latest release files.

    Visit http://bower.io for installation instructions.

    After you have installed bower, you need to register the package: bower register jquery.sparkline git://github.com/gwatts/jquery.sparkline.git

    opened by peters 11
  • Wrong display of minimum value(s)

    Wrong display of minimum value(s)

    Minimum value from array are not displayed correctly (there is a gap).

    See example: http://jsfiddle.net/8thrB/ ("20" is display like a zero because 20 is the smallest value from an array)

    opened by r-a-f 10
  • script fails when dynamically loaded

    script fails when dynamically loaded

    An exception gets thrown inside of the initStyles function when the script is loaded dynamically.

    This is because the following line:

    $(initStyles);

    will execute immediately if the dom is ready. If it executes immediately, the addCss function has not yet been defined.

    The fix is to move $(initStyles); after addCss is properly defined.

    bug 
    opened by joeenzminger 10
  • Stacked bar charts not rendering correctly.

    Stacked bar charts not rendering correctly.

    I have a stacked bar chart, and have noticed that the proportions of the charts seem to be incorrect.

    example

    The light blue bar has a value of 30, while the dark blue bar has a value of 15. Shouldn't the dark bar be exactly half the height of the light blue bar? Otherwise it would seem to give you an incorrect visual representation of the data.

    bug 
    opened by aeronauticus 9
  • A chart having three components (

    A chart having three components ( "undefined" in IE and Firefox..Works fine with Chrome

    I have sparkline chart having three components (101, 0, 100). It plots perfectly on chrome but there is a "un" instead of the chart on IE and in Fire Fox. IE version is 7 and Fire fox version is 16.0.2

    bug 
    opened by Ankit1912 8
  • bug using jquery.sparkline with jquery ui tabs()

    bug using jquery.sparkline with jquery ui tabs()

    Hi,

    And first thanks for this plugin. It seems there is a bug using it with tabs() function. Indeed, sparkline is working well on the active tab, but not working when clicking others tabs.

    I've seen the problem also described her in SO : http://stackoverflow.com/questions/13952354/sparklines-not-drawing-when-using-bootstrap-and-using-tabs

    The proposed workaround is not working. It just hides the span containing values. Any help/clue would be welcome.

    (I'm using version 2.1.2)

    Thanks

    question 
    opened by simogeo 5
  • cannot get $.sparkline_display_visible(); to draw sparklines

    cannot get $.sparkline_display_visible(); to draw sparklines

    this is an awsome plugin,

    I am having trouble getting $.sparkline_display_visible() to show my sparklines on display:none div's

    I am using: sparklines 2.0 jquery 1.7.1

    I noticed in the code: // jQuery 1.3.0 completely changed the meaning of :hidden :-/ $.fn.jquery < '1.3.0'

    If I change that to: $.fn.jquery >= '1.3.0'

    $.sparkline_display_visible() draws the graph without any issues, is this a typo or am I doing something wrong on my end.

    thank you for all your hard work!

    question 
    opened by mojopollo 5
  • Undefined error in IE 8 related to document.namespaces

    Undefined error in IE 8 related to document.namespaces

    I'm seeing an "Unspecified error" in IE 8 sporadically when loading.

    The section of code flagged looks to be the VML code at: if (document.namespaces && !document.namespaces.v) { $.fn.sparkline.hasVML = true; document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML'); } else { $.fn.sparkline.hasVML = false; }

    The behavior seems pretty consistent with what I see described here: http://drupal.org/node/613002

    One fix that I can see from what's described above would be to make hasVML a function instead of a boolean and call it when needed (potentially caching the result after the first call). That way it's less likely to get called before document.ready / document.load.

    bug 
    opened by timtucker 4
  • use window.devicePixelRatio for hidpi displays

    use window.devicePixelRatio for hidpi displays

    If the canvas element is scaled by window.devicePixelRatio and then scaled back down by the CSS properties the results look better on HiDPI displays. Given the small nature of most sparklines, this is pretty huge. #nopun

    Here are two images from my use case. First with stock code... image

    And here with a modified _calculatePixelDims... image

    Those results come from this incomplete patch:

    index 721e03b..805aa12 100644
    --- a/src/site/jquery.sparkline.js
    +++ b/src/site/jquery.sparkline.js
    @@ -2626,19 +2626,13 @@
              */
             _calculatePixelDims: function (width, height, canvas) {
                 // XXX This should probably be a configurable option
    -            var match;
    -            match = this._pxregex.exec(height);
    -            if (match) {
    -                this.pixelHeight = match[1];
    -            } else {
    -                this.pixelHeight = $(canvas).height();
    -            }
    -            match = this._pxregex.exec(width);
    -            if (match) {
    -                this.pixelWidth = match[1];
    -            } else {
    -                this.pixelWidth = $(canvas).width();
    -            }
    +            const heightMatch = this._pxregex.exec(height);
    +            const pixelHeight = heightMatch ?  Number(heightMatch[1]) : $(canvas).height();
    +            const widthMatch = this._pxregex.exec(width);
    +            const pixelWidth = widthMatch ?  Number(widthMatch[1]) : $(canvas).width();
    +            const dpr = window.devicePixelRatio || 1;
    +            this.pixelHeight = Math.round(pixelHeight * dpr);
    +            this.pixelWidth = Math.round(pixelWidth * dpr);
             },
     
             /**
    @@ -2710,7 +2704,7 @@
                 this.shapes = {};
                 this.shapeseq = [];
                 this.currentTargetShapeId = undefined;
    -            $(this.canvas).css({width: this.pixelWidth, height: this.pixelHeight});
    +            $(this.canvas).css({width, height});
             },
     
             _getContext: function (lineColor, fillColor, lineWidth) {
    

    I'd be happy to complete the work on this (hover over is broken) and write it using more compatible code (e.g. no const) if this project is still active (last commit 2013). Otherwise I'll probably fork and put my changes up there.

    opened by mayfield 2
  • BUG: bar chart incorrect height / bars not proportional

    BUG: bar chart incorrect height / bars not proportional

    I created a bar chart with 3 bars. The first is 10 and the other bars are 5 Here's the result: http://prntscr.com/ptjyi8 The bars with a value of 5 should have a height of 50% of the bar with a value of 10, but it doesn't

    The bug can be reproduced using your demo.

    I would appreciate it if you can fix this bug. Thanks!

    opened by ws420 3
  • Problem with composite charts

    Problem with composite charts

    @gwatts

    I have an issue with rendering a single value baseline on top of a line chart. It is basically placing the second line at the bottom of the sparkline plot even if the values are in the middle of the first dataset.

    I have managed to replicate it here, soI knowit'snot code related, any help is greatly appreciated!:

    https://jsfiddle.net/fh9m4gb3/2/

    
    
                        $("#sparkline").sparkline(stream, {
    
                            spotColor: color,
                            type: 'line',
                            width: '100%',
                            height: '100%',
                            lineColor: color,
                            fillColor: '#BABABA40',
                            minSpotColor: '#C90000',
                            maxSpotColor: '#002AB3',
                            spotRadius: 4,
                            disableHighlight: true,
                            disableTooltips: true,
                            changeRangeMin: changeMinimum,
                            chartRangeMax: chartRangeMaximum,
                            drawNormalOnTop: false
    
                        });
    
                        if (winLossBarrier != 'no open trade') {
                            tradeLine = [winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier,
                                winLossBarrier, winLossBarrier, winLossBarrier, winLossBarrier
                            ]
    
                            $("#sparkline").sparkline(tradeLine, {
    
                                spotColor: false,
                                type: 'line',
                                width: '100%',
                                height: '100%',
                                lineColor: '#002AB3',
                                fillColor: false,
                                minSpotColor: false,
                                maxSpotColor: false,
                                spotRadius: 4,
                                disableHighlight: true,
                                disableTooltips: false,
                                changeRangeMin: changeMinimum,
                                chartRangeMax: chartRangeMaximum,
                                composite: true,
    
                                drawNormalOnTop: false
    
                            });
    
    
    
    opened by wilburforce83 7
Reusable JavaScript library for creating sketchy/hand-drawn styled charts in the browser.

roughViz.js is a reusable JavaScript library for creating sketchy/hand-drawn styled charts in the browser, based on D3v5, roughjs, and handy. Why? Use

Jared Wilber 6.4k Jan 4, 2023
JQuery plugin for creating charts

JQuery Linechart JQuery plugin for building a linechart. Chart ruler completely on HTML/CSS/JS. Bar chart, calendar view visualisation. Diagram, graph

Kirill Stepkin 42 Oct 25, 2022
JQuery plugin for creating charts

JQuery Linechart JQuery plugin for building a linechart. Chart ruler completely on HTML/CSS/JS. Bar chart, calendar view visualisation. Diagram, graph

Kirill Stepkin 42 Oct 25, 2022
Django Class Based Views to generate Ajax charts js parameters.

Django Chartjs Django Chartjs lets you manage charts in your Django application. This is compatible with Chart.js and Highcharts JS libraries. Using a

PeopleDoc 377 Dec 25, 2022
Attractive JavaScript charts for jQuery

flot About flot is a JavaScript plotting library for engineering and scientific applications derived from Flot: http://www.flotcharts.org/ Take a look

Flot 5.9k Dec 22, 2022
JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.

GoJS, a JavaScript Library for HTML Diagrams GoJS is a JavaScript and TypeScript library for creating and manipulating diagrams, charts, and graphs. S

Northwoods Software Corporation 6.6k Dec 30, 2022
Ember Charts 3.5 2.3 L2 JavaScript A powerful and easy to use charting library for Ember.js

Ember Charts A charting library built with the Ember.js and d3.js frameworks. It includes time series, bar, pie, and scatter charts which are easy to

Addepar 793 Dec 7, 2022
Chart.js plugin to create charts with a hand-drawn, sketchy, appearance

chartjs-plugin-rough Chart.js plugin to create charts with a hand-drawn, sketchy, appearance Version 0.2 requires Chart.js 2.7.0 or later, and Rough.j

Akihiko Kusanagi 73 Dec 1, 2022
Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library

laravel-chartjs - Chart.js v2 wrapper for Laravel 5.x Simple package to facilitate and automate the use of charts in Laravel 5.x using the Chart.js v2

Felix Costa 473 Dec 15, 2022
J2CL and GWT Charts library based on CHART.JS

Charba - J2CL and GWT Charts library based on CHART.JS What's Charba GWT Web toolkit doesn't have charting library available out of the box. There are

Pepstock.org 56 Dec 17, 2022
Synchro Charts is a front-end component library that provides a collection of components to visualize time-series data.

Synchro Charts Synchro Charts is a front-end component library that provides a collection of components to visualize time-series data. You can learn m

Amazon Web Services - Labs 60 Dec 29, 2022
An open-source visualization library specialized for authoring charts that facilitate data storytelling with a high-level action-driven grammar.

Narrative Chart Introduction Narrative Chart is an open-source visualization library specialized for authoring charts that facilitate data storytellin

Narrative Chart 45 Nov 2, 2022
Create beautiful charts with one line of JavaScript

Chartkick.js Create beautiful charts with one line of JavaScript See it in action Supports Chart.js, Google Charts, and Highcharts Also available for

Andrew Kane 1.2k Jan 2, 2023
Create beautiful JavaScript charts with one line of React

React Chartkick Create beautiful JavaScript charts with one line of React See it in action Supports Chart.js, Google Charts, and Highcharts Quick Star

Andrew Kane 1.2k Dec 28, 2022
📊 Interactive JavaScript Charts built on SVG

A modern JavaScript charting library to build interactive charts and visualizations with simple API. Our Partner ApexCharts is now a partner of Fusion

ApexCharts 12.1k Jan 3, 2023
Create beautiful JavaScript charts with one line of Ruby

Chartkick Create beautiful JavaScript charts with one line of Ruby. No more fighting with charting libraries! See it in action Chartkick 4.0 was recen

Andrew Kane 6.1k Jan 8, 2023
Emprise Javascript Charts

EJSChart 100% Powerful, Clean & Functional Javascript Charts Whether at home, a medium sized or enterprise venture, EJSCharts will seamlessly help you

Emprise Corporation 34 Jun 3, 2021
Beautiful and interactive javascript charts for Java-based web applications.

Wicked Charts Beautiful and interactive JavaScript charts for Java-based web applications. Check out the Changelog Check out the Feature Overview with

adesso SE 85 Aug 23, 2022
A simple script for pure javascript charts.

MK Charts A simple pure Javascript for displaying circle charts. Demo: https://mkirschen.de/mk-scripts/mk-charts/ Circle charts To insert a chart all

Marcus Kirschen 6 Dec 14, 2022