Giter VIP home page Giter VIP logo

rickshaw's Introduction

NPM version Build Status Coverage Status

Rickshaw

Rickshaw is a JavaScript toolkit for creating interactive time series graphs, developed at Shutterstock

Table of Contents

Getting Started

Getting started with a simple graph is straightforward. Here's the gist:

var graph = new Rickshaw.Graph( {
  element: document.querySelector('#graph'),
  series: [
    {
      color: 'steelblue',
      data: [ { x: 0, y: 23}, { x: 1, y: 15 }, { x: 2, y: 79 } ]
    }, {
      color: 'lightblue',
      data: [ { x: 0, y: 30}, { x: 1, y: 20 }, { x: 2, y: 64 } ]
    }
  ]
} );

graph.render();

See the overview, tutorial, and examples for more.

Install

In the browser, manually add rickshaw.min.js and rickshaw.min.css in the document head.

Alternatively, you can install Rickshaw using Bower or npm.

# With bower
bower install rickshaw
# With npm
npm install --save rickshaw

Dependencies

Rickshaw relies on the fantastic D3 visualization library to do lots of the heavy lifting for stacking and rendering to SVG.

Some extensions require jQuery and jQuery UI, but for drawing some basic graphs you'll be okay without.

Rickshaw uses jsdom to run unit tests in Node to be able to do SVG manipulation. As of the jsdom 7.0.0 release, jsdom requires Node.js 4 or newer jsdom changelog. If you want to run the tests on your machine, and you don't have access to a version of node >= 4.0, you can npm install jsdom@3 so that you can run the tests using the 3.x branch of jsdom.

Rickshaw.Graph

A Rickshaw graph. Send an element reference, series data, and optionally other properties to the constructor before calling render() to point the graph. A listing of properties follows. Send these as arguments to the constructor, and optionally set them later on already-instantiated graphs with a call to configure()

element

A reference to an HTML element that should hold the graph.

series

Array of objects containing series data to plot. Each object should contain data at a minimum, a sorted array of objects each with x and y properties. Optionally send a name and color as well. Some renderers and extensions may also support additional keys.

renderer

A string containing the name of the renderer to be used. Options include area, stack, bar, line, and scatterplot. Defaults to line. Also see the multi meta renderer in order to support different renderers per series.

width

Width of the graph in pixels. Falls back to the width of the element, or defaults to 400 if the element has no width.

height

Height of the graph in pixels. Falls back to the height of the element, or defaults to 250 if the element has no height.

min

Lower value on the Y-axis, or auto for the lowest value in the series. Defaults to 0.

max

Highest value on the Y-axis. Defaults to the highest value in the series.

padding

An object containing any of top, right, bottom, and left properties specifying a padding percentage around the extrema of the data in the graph. Defaults to 0.01 on top for 1% padding, and 0 on other sides. Padding on the bottom only applies when the yMin is either negative or auto.

interpolation

Line smoothing / interpolation method (see D3 docs); notable options:

  • linear: straight lines between points
  • step-after: square steps from point to point
  • cardinal: smooth curves via cardinal splines (default)
  • basis: smooth curves via B-splines
stack

Allows you to specify whether series should be stacked while in the context of stacking renderers (area, bar, etc). Defaults to stack: 'true'. To unstack, unstack: 'true'.

Methods

Once you have instantiated a graph, call methods below to get pixels on the screen, change configuration, and set callbacks.

render()

Draw or redraw the graph.

configure()

Set properties on an instantiated graph. Specify any properties the constructor accepts, including width and height and renderer. Call render() to redraw the graph and reflect newly-configured properties.

onUpdate(f)

Add a callback to run when the graph is rendered

Extensions

Once you have a basic graph, extensions let you add functionality. See the overview and examples listing for more.

  • Rickshaw.Graph.Legend - add a basic legend

  • Rickshaw.Graph.HoverDetail - show details on hover

  • Rickshaw.Graph.JSONP - get data via a JSONP request

  • Rickshaw.Graph.Annotate - add x-axis annotations

  • Rickshaw.Graph.RangeSlider - dynamically zoom on the x-axis with a slider

  • Rickshaw.Graph.RangeSlider.Preview - pan and zoom via graphical preview of entire data set

  • Rickshaw.Graph.Axis.Time - add an x-axis and grid lines with time labels

  • Rickshaw.Graph.Axis.X - add an x-axis and grid lines with arbitrary labels

  • Rickshaw.Graph.Axis.Y - add a y-axis and grid lines

  • Rickshaw.Graph.Axis.Y.Scaled - add a y-axis with an alternate scale

  • Rickshaw.Graph.Behavior.Series.Highlight - highlight series on legend hover

  • Rickshaw.Graph.Behavior.Series.Order - reorder series in the stack with drag-and-drop

  • Rickshaw.Graph.Behavior.Series.Toggle - toggle series on and off through the legend

Rickshaw.Color.Palette

Rickshaw comes with a few color schemes. Instantiate a palette and specify a scheme name, and then call color() on the palette to get each next color.

var palette = new Rickshaw.Color.Palette( { scheme: 'spectrum2001' } );

palette.color() // => first color in the palette
palette.color() // => next color in the palette...

Optionally, to palette.color() can take a numeric argument to specify which color from the palette should be used (zero-indexed). This can be helpful when assigning a color to series of a plot with particular meaning:

var palette = new Rickshaw.Color.Palette( { scheme: 'colorwheel' } );

palette.color(0) // => first color in the palette - red in this example
palette.color(2) // => third color in the palette - light blue

Color Schemes

  • classic9
  • colorwheel
  • cool
  • munin
  • spectrum14
  • spectrum2000
  • spectrum2001

Interpolation

For graphs with more series than palettes have colors, specify an interpolatedStopCount to the palette constructor.

Rickshaw and Cross-Browser Support

This library works in modern browsers and Internet Explorer 9+.

Rickshaw relies on the HTMLElement#classList API, which isn't natively supported in Internet Explorer 9. Rickshaw adds support by including a shim which implements the classList API by extending the HTMLElement prototype. You can disable this behavior if you like, by setting RICKSHAW_NO_COMPAT to a true value before including the library.

Minification

If your project uses minification, you will need to give a hint to the minifier to leave variables named $super named $super. For example, with uglify on the command line:

$ uglify-js --reserved-names "$super" rickshaw.js > rickshaw.min.js

Or a sample configuration with grunt-contrib-uglify:

uglify: {
  options: {
    mangle: { except: ["$super"] }
  }
}

Development

For building, we use Node and npm. Running npm run build or make should get you going with any luck.

After doing a build you can run the tests with the command: npm test

For more availible options see the package.json scripts section.

Contributing

Pull requests are always welcome! Please follow a few guidelines:

  • Please don't include updated versions of rickshaw.js and rickshaw.min.js. Just changes to the source files will suffice.
  • Add a unit test or two to cover the proposed changes
  • Do as the Romans do and stick with existing whitespace and formatting conventions (i.e., tabs instead of spaces, etc)
  • Consider adding a simple example under examples/ that demonstrates any new functionality

Please note that all interactions with Shutterstock follow the Contributor Covenant Code of Conduct.

Authors

This library was developed by David Chester, Douglas Hunter, and Silas Sewell at Shutterstock

License

Copyright (C) 2011-2020 by Shutterstock Images, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

rickshaw's People

Contributors

aw avatar bfolkens avatar bhashit avatar callumj avatar cesine avatar chris-chambers avatar chrisirhc avatar dchester avatar dependabot[bot] avatar doaboa avatar dwt avatar ebeal avatar gt8073a avatar illusori avatar jay3686 avatar katt avatar kvisle avatar luke3141 avatar mikepb avatar msand avatar rbu avatar richardlitt avatar rojotek avatar rowanc avatar silas avatar stuartnelson3 avatar thomasyip avatar tlackemann avatar travisbeck avatar wallin 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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rickshaw's Issues

more compact data series

Is it possible to submit the data series as just an array of x,y?

[ [x,y], [x,y] ]

This avoids the need to send all of the duplicate x, y back from the server.

Animate the adding of new values

On a line graph, it could be nice to have the impression that the values are added continuously even if it's not really the case. This would be made possible if the values where sliding continuously from the right to the left, and the last value is displayed after the duration of the slide.

This means that the graph will not be real time anymore, but the visualisation could be smoother and nicer to look. Any thoughts on this?

Dynamically Re-sizing the Graph.

Hi,

I would like to be able to change the width and height of the chart on the fly; is this currently possible with rickshaw?

Kind Regards

Support multiple Y-axis

Is there any way to support multiple Y-axis?

For example, one on the left hand side, another on the right hand sides. And it could have different scale.

I can't see a way to do it.

We dig into the source code, and found out it limit Y-axis on left hand side and only support one Y-axis.

Resizing a graph in a array/dictionary of graphs

This errors out in latest also when you try to resize


<!doctype>

<script src="../vendor/d3.min.js"></script>
<script src="../vendor/d3.layout.min.js"></script>

<script src="../rickshaw.js"></script>


<div id="chart"></div>

<button id="change" onclick="change()">Push Me</button>

<div id="chart2"></div>

<script>

graphs = {};

graphs['g1'] = new Rickshaw.Graph( {
    element: document.querySelector("#chart"),
    width: 300,
    height: 200,
    interpolation: 'step-after',
    series: [
        {
            data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
            color: 'steelblue'
        }
    ]
} );
graphs['g1'].render();


graphs['g2'] = new Rickshaw.Graph( {
    element: document.querySelector("#chart2"),
    width: 300,
    height: 200,
    interpolation: 'step-after',
    series: [
        {
            data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
            color: 'steelblue'
        }
    ]
} );
graphs['g2'].render();

function change() {
    graphs['g1'].configure({ width: 600, height: 400 }); 
    graphs['g1'].render();
};

</script>

Errors with

Uncaught ReferenceError: graph is not defined rickshaw.js:566

Tooltip X-axis correction not working for last item

As you know, when you hover over a bar, the right side of it approximates to the index of the next bar, since the bars are drawn to the right of the tick line.. The problem here is that for the n-1'th bar, if the approximated x index is n, there is no n+1 element in the series list, and hence the correction function in update() in Rickshaw.Graph.HoverDetail doesn't fire.. replacing it with the following works:

    for (var i = approximateIndex; i < stackedData[0].length;) {

        if (i == stackedData[0].length - 1) {
            if (!stackedData[0][i]) {
                break;
            }

            if (stackedData[0][i].x <= domainX) {
                dataIndex = i;
                break;
            }
        } else {
            if (!stackedData[0][i] || !stackedData[0][i + 1]) {
                break;
            }

            if (stackedData[0][i].x <= domainX && stackedData[0][i + 1].x > domainX) {
                dataIndex = i;
                break;
            }
        }
        if (stackedData[0][i] >= domainX) { i++ } else { i-- }
    }

Add Gantt Chart

Rickshaw looks like a great start to creating a gantt chart, similiar to what Wrike provides. Is this something that's been mentioned before?

ajax re-poll for updates

Is there anyway to accomplish this? I have yet to find a good way to update the graph without refreshing the page for a new ajax request.

Rickshaw.Graph.Ajax can't call Rickshaw.Graph.Legend namespace

I think this might be because the Rickshaw.Graph object is one level deep (under self for Rickshaw.Graph.Ajax
e.g.
Rickshaw.Graph.Ajax
dataURL: "/logs/json?tags=jmeter"
graph: Rickshaw.Graph
proto: Object

You therefore get the following error when trying to create a legend:
Uncaught TypeError: Cannot call method 'map' of undefined

I'm calling legend like this:
var legend = new Rickshaw.Graph.Legend( {
graph: graph,
element: document.getElementById('legend')

} );

I tried passing in the nested grap object like this to no avail. Are you able to help?
var legend = new Rickshaw.Graph.Legend( {
graph: graph.graph,
element: document.getElementById('legend')

} );

Plot Points

Is there away to show all the plot points all the time on a line graph with out having to hover over.

ajax graph with axis

This doesn't seem to work in the latest master

    var graph;
    graph = new Rickshaw.Graph.Ajax({
      element: document.getElementById("chart"),
      width: 500,
      height: 250,
      renderer: 'line',
      interpolation: 'linear',
      dataURL: 'data.json',
      series: [{
        name: 'New York',
        color: 'steelblue'
      }],
      onComplete: function() {
        var x_axis = new Rickshaw.Graph.Axis.Time({
          graph: graph
        });
        x_axis.graph.update();
      }
    });

I get the following

Uncaught TypeError: Object [object Object] has no method 'onUpdate' rickshaw.js:1122

Also is there a way to poll via ajax? to always get updates that is built into rickshaw?

last object in data array is not rendered

Hi, I am using Scatterplot example which works well. It shows 5 values correctly. The problem begin when i change the renderer to 'bar' - then i can see only 4 values - it doesn't render last object in the data array

URL: http://code.shutterstock.com/rickshaw/guide/scatterplot-1.html

original:

var graph = new Rickshaw.Graph( {
    element: document.querySelector("#chart"),
    width: 235,
    height: 85,
    renderer: 'scatterplot',
    stroke: true,
    series: [ {
        data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
        color: 'steelblue'
    } ]
} );
graph.render();

modified code which shoud display 5 bars, but only 4 are visible

var graph = new Rickshaw.Graph( {
    element: document.querySelector("#chart"),
    width: 235,
    height: 85,
    renderer: 'bar',
    stroke: true,
    series: [ {
        data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
        color: 'steelblue'
    } ]
} );
graph.render();

`object is not a function` error after uglify minification

When minifying Rickshaw with uglify (via requirejs/r.js), I'm getting an "object is not a function" error somewhere from Rickshaw, while trying to render a bar graph. Here's a screenshot from Chrome's script panel, paused on uncaught exceptions: http://bassistance.de/i/50e880.png

So the error is thrown in Rickshaw.Graph.Renderer.Bar.Rickshaw.Class.create.initialize, which is reasonable, as both arguments are objects, not functions. Though I have no idea why an object is passed where a function is expected. Maybe someone more familar with the code base can tell.

Here's the code to render the graph in our application: https://gist.github.com/5552abdf24227e5f7cb6
Without minification that works fine.

Use of pointer-events: none; on non-svg items

In detail.css, you apply pointer-events: none; on .rickshaw_graph .detail to ensure that tooltips don't get hovered over and thus don't prevent other tooltips from popping up..

I find that there are two issues with that:

  1. pointer-events: none; shouldn't really be used for non-svg items as described in the spec
  2. it's impossible to hover over the tooltip itself, which might be nice if there is a link in there or something like that..

In my opinion, the approach of disabling pointer events and setting opacity: 0 to all tooltips would work much nicer if you enabled pointer events and then replace the opacity switch with a display: none/inline switch..

Works like a charm for me and everything is as expected

Cheers

Support for older browsers

I'm running older Chromium version which does not have support for the classList and rickshaw crashes in:

this.element.classList.add('rickshaw_graph')

Is it possible to make is more compatible with older browsers?

Set custom Y-scale (unit and extremums) for each time serie

Hi,

I have two different time series (memory usage, and number of processes), that use different units and scales.

is it possible with Rickshaw to have different scales/units, for each time serie ?

I'm thinking about creating two superposed rickshaw renderer, but it is a bit heavy (and I would love to use the same hover tooltip to show values in both series).
Or extending/hacking rickshaw code, but maybe there is a nicer solution?

Thanks,
Julian

14 questions about rickshaw

Hello I'm writing an article about libraries visualization.
Here is the article: Choice Free JavaScript Data Visualization Library
To avoid inaccuracies, I'll be very grateful if you could briefly answer the following questions:

  1. Which supported chart types by category (bar / line / area / radar / xy / scatter / combo / pie / donut / column / logarithmic scale charts / time plot?
  2. Is there a HTML5 support (fallback method)?
  3. Size lbrary?
  4. Is there a GWT support?
  5. Are there any dependencies on other libraries, if so, which ones?
  6. Is Library Mobile friendly?
  7. Which supported levels of interactiveness (legends, hovers and drilldowns)?
  8. License?
  9. Can incorporate custom graphics (background images, icons) ?
  10. Largest Sites currently using?
  11. Count questions / month, users / developers / commits in last month) ?
  12. Formats supported (jpg / png / pdf) ?
  13. Interesting features?
  14. Lack of certain standard features?

Thank You,
Denis Krusko

Graph negatives values seems impossible

IT seems that we are unable to display negative values on the chart. I didn't find any param to set Y-Axis min to anything that is not "zero".
Is there a clean way to do this ?

Group points depending on zoom level

Hi there,

Maybe this is possible, but I don't think so.. What I would like to happen is for a bunch of data points, submitted with corresponding timestamps, to be grouped by week/month/year depending on the zoom level.. So for example if I have hundreds of data points per month for about a year, I would like the default view in a bar plot e.g. to have 12 bars, one for each month, with the total value of all the points inside that month.. When I zoom in, it might then show data by week or day.. then by hour/minute..

Basically, this entails allowing to split series data into points that have their own title and the series name and then grouping these together.

I'll try and look into it, but any help would be appreciated.

Cheers,
Martin

Time axis off-by-one error

It seems like there is an off-by-one error somewhere in Rickshaw.
(Possibly in Rickshaw.Fixtures.Time.js or Rickshaw.Graph.Axis.Time.js)

The problem is that X-axis lines are shifted one time unit. The unit is year in this case, but the same thing happens if I change it to month.

Off by one month

I’m using the latest (GitHub) version of Rickshaw and d3.v2.min.js

Wrap ticks in a div

This would allow better control of the ticks, especially since the first tick is a little bit more padded as opposed to the others it seems - allows to use first-child selector, and is also much nicer for dom.. In Rickshaw.Graph.Axis.Time

this.render = function() {

    this.elements.forEach( function(e) {
        e.parentNode.removeChild(e);
    } );

    this.elements = [];

    var offsets = this.tickOffsets();

    var ticks_el = document.createElement('div');
    ticks_el.classList.add('x_ticks');

    offsets.forEach( function(o) {

        if (self.graph.x(o.value) > self.graph.x.range()[1]) return;

        var element = document.createElement('div');
        element.style.left = self.graph.x(o.value) + 'px';
        element.classList.add('x_tick');
        element.classList.add(self.ticksTreatment);

        var title = document.createElement('div');
        title.classList.add('title');
        title.innerHTML = o.unit.formatter(new Date(o.value * 1000));
        element.appendChild(title);

        ticks_el.appendChild(element);
        self.elements.push(element);

    } );

    self.graph.element.appendChild(ticks_el);
};

Include the un-minified built files for easy debugging...

Building from source was a snap, but not everyone wants to install node. Also, I'm on v0.6.5 and had to run make twice:

➜ rickshaw git:(master) make
npm install clean-css
[email protected] ../node_modules/clean-css
└── [email protected]
cat src/css/detail.css src/css/graph.css src/css/legend.css > rickshaw.css
/Users/Rubikzube/node_modules/.bin/cleancss rickshaw.css > rickshaw.min.css

node.js:284
throw new Error('process.stdout cannot be closed');
^
Error: process.stdout cannot be closed
at SyncWriteStream. (node.js:284:15)
at output (/Users/Rubikzube/node_modules/clean-css/bin/cleancss:43:7)
at /Users/Rubikzube/node_modules/clean-css/bin/cleancss:24:5
at [object Object]. (fs.js:115:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1111:12)
at Object.wrapper as oncomplete
make: *** [rickshaw.min.css] Error 1

➜ rickshaw git:(master) make
npm install uglify-js
[email protected] ../node_modules/uglify-js
cat src/js/Rickshaw.js src/js/Rickshaw.Graph.js src/js/Rickshaw.Fixtures.Color.js src/js/Rickshaw.Fixtures.RandomData.js src/js/Rickshaw.Fixtures.Time.js src/js/Rickshaw.Fixtures.Number.js src/js/Rickshaw.Color.Palette.js src/js/Rickshaw.Graph.Ajax.js src/js/Rickshaw.Graph.Annotate.js src/js/Rickshaw.Graph.Axis.Time.js src/js/Rickshaw.Graph.Axis.Y.js src/js/Rickshaw.Graph.Behavior.Series.Highlight.js src/js/Rickshaw.Graph.Behavior.Series.Order.js src/js/Rickshaw.Graph.Behavior.Series.Toggle.js src/js/Rickshaw.Graph.HoverDetail.js src/js/Rickshaw.Graph.JSONP.js src/js/Rickshaw.Graph.Legend.js src/js/Rickshaw.Graph.RangeSlider.js src/js/Rickshaw.Graph.Renderer.Line.js src/js/Rickshaw.Graph.Renderer.Stack.js src/js/Rickshaw.Graph.Renderer.Bar.js src/js/Rickshaw.Graph.Smoother.js src/js/Rickshaw.Graph.Unstacker.js src/js/Rickshaw.Series.js > rickshaw.js
/Users/Rubikzube/node_modules/.bin/uglifyjs rickshaw.js > rickshaw.min.js

hover details for negative mouse domain

as they are, hover details don't show up when the mouse is below zero. I narrowed down the behavior to this line:

if (domainMouseY > d.value.y0 && domainMouseY < d.value.y0 + d.value.y && !activeItem)

line 100 in Rickshaw.Graph.HoverDetail.js. I tried setting y0 to something else for the graph values, but couldn't figure out how to get it to be anything other than zero, so I ended up extending the class and overriding that method with an update that instead checked

if (domainMouseY > graph.min && domainMouseY < d.value.y0 + d.value.y && !activeItem)

which is probably what it was going for anyway. that fixed the issue, and hasn't raised any new ones.

Change Ajax data file and redraw graph

Hey,

Im currently using the Ajax graph to view some results, but since I have several files to view I want to be able to switch between each using a drop down menu and redraw the graph and axis

Is this possible?
How would i go about doing this?

Thanks in advance

Add a tick for the first x value

At the moment, the method that adds ticks skips the first and goes straight to the second value.. The fix is again in Rickshaw.Graph.Axis.Time

this.tickOffsets = function() {

    var domain = this.graph.x.domain();

    var unit = this.fixedTimeUnit || this.appropriateTimeUnit();
    var count = Math.ceil((domain[1] - domain[0]) / unit.seconds);

    var runningTick = domain[0];

    var offsets = [];
    offsets.push( { value: runningTick, unit: unit } );

    for (var i = 0; i < count-1; i++) {

        tickValue = time.ceil(runningTick, unit);
        runningTick = tickValue + unit.seconds / 2;

        offsets.push( { value: tickValue, unit: unit } );
    }

    return offsets;
};

detail, item active and various web layouts

.rickshaw_graph .detail .item.active from detail.css would benefit by adding 'width: auto; height:auto;' to auto-size the detail tooltip on graph mouse hover. In it's current form, the tooltip doesn't get auto-sized when using a relative/percentage based layout.

Can't seem to apply an x_axis to a Rickshaw.Graph.Ajax chart

I've implemented a chart that uses a JSON file per your example. Now I'm trying to add an x axis to it, but the x-axis doesn't display. Here's what I have:

var graph = new Rickshaw.Graph.Ajax( {
element: document.getElementById("chart"),
width: 500,
height: 250,
renderer: 'line',
interpolation: 'linear',
dataURL: 'data.json',
series: [{
name: 'MyData',
color: 'steelblue'
}]
});

var x_axis = new Rickshaw.Graph.Axis.Time( { graph: graph } );

graph.render();

Any ideas?

Running samples in IE9 produces JS errors

SCRIPT5007: Unable to set value of the property 'Color': object is null or undefined
rickshaw.min.js, line 1 character 3349

SCRIPT5007: Unable to get value of the property 'Palette': object is null or undefined
colors.html, line 44 character 2

Haven't debugged it thoroughl, but it seems to stem from the namespacing function.

namespace: function(namespace, obj) {

    var parts = namespace.split('.');
    parent = Rickshaw; // At this point, it's trying to assign the value to window.parent which no-ops. declaring it as a local variable should do the right thing.

Make is failing

rickshaw master $ make
Makefile:48: *** multiple target patterns.  Stop.

rickshaw master $ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin10.0

Bar plot tooltip activation area

If you take at http://code.shutterstock.com/rickshaw/examples/extensions.html - select bar plot and zoom in so that you only have a few bars there - try hovering over a bar - you won't see a tooltip unless you hover exactly along the left edge of a bar..

I doubt that this is by design, but even if it is, this is very annoying from usability point of view - surely one would expect the whole bar to trigger the tooltip.

Thanks for looking into this.

Cheers,
Martin

auto-aggregate with rangeslider

Is it possible to auto-aggregate data when using the rangeslider. A use case would be having hourly data points when zoomed in, but daily (hourly data added up) when zoomed out. If not, could this be a feature request? (I didn't see a google group for this type of discussion, so my apologies for posting in the issues)

missing license

Hi,
the rickshaw code that is currently available on github has no license.

So while this is indeed open-source, it is not FREE in any way.
That's all right (that's your choice), anyway it would be much better to
explicitly state it in the README (usually along with a single-line copyright
statement) and if needed, add a LICENSE file that contains the whole license.

I hope you'll understand the importance of that matter,
regards,
Jérémy.

how to provide datetime data to series ?

Whenever I provide date/time data to rickshaw, it reports:

uncaught exception: x and y properties of points should be numbers instead of string and number

the data is provided in standard json

[{"x":"2011-11-06T11:57:29-05:00","y":0},{"x":"2011-12-06T11:57:29-05:00","y":0},{"x":"2012-01-06T11:57:29-05:00","y":0},{"x":"2012-02-06T11:57:29-05:00","y":0},{"x":"2012-03-06T11:57:29-05:00","y":0},{"x":"2012-04-06T11:57:29-04:00"}]

I note you do not provide examples of dates or times being used in a series - how is it done ?

thanks.
Jodi

Different series length

Any way to allow different series length to display "cut" areas. A typical usage would be to display 2 charts, the first one being displayed to current date, and the other one would "predict" the future chart flow (for financial charts etc.)

Resizing a graph loses the interpolation

Here is a sample.. If you set the interpolation on a new render() after a configure it will lose it and go back to the default which seems to be cardinal

<!doctype>

<script src="../vendor/d3.min.js"></script>
<script src="../vendor/d3.layout.min.js"></script>

<script src="../rickshaw.js"></script>


<div id="chart"></div>


<button id="change" onclick="change()">Push Me</button>

<script>

var graph = new Rickshaw.Graph( {
    element: document.querySelector("#chart"),
    width: 300,
    height: 200,
    interpolation: 'step-after',
    series: [
        {
            data: [ { x: 0, y: 40 }, { x: 1, y: 49 }, { x: 2, y: 38 }, { x: 3, y: 30 }, { x: 4, y: 32 } ],
            color: 'steelblue'
        }
    ]
} );
graph.render();

function change() {
    graph.configure({ width: 600, height: 400 }); 
    graph.render();
};

</script>

All tooltips rendered on hover - one is enough

For any chart, when you hover over one data point, a tooltip is actually generated for every data point in the chart - the other ones aren't shown, but this results in potentially hundreds of div elements being added, moved, etc.. resulting in really poor performance, not to mention that this is completely useless.

To fix, in Rickshaw.Graph.HoverDetail render() function, move if (d.active) { from covering the last two lines of the loop, to the very top of the loop, just before var item = document.createElement('div'); - that was only one element is created and shown.. all that needs.

I'm sure this can be made even more efficient, but this would be a good start.

Arbitrary X axis formatting

Hi,

I need an X axis formatted to an arbitrary number scale. There doesn't currently appear to be a way to format the X axis for anything other than time, unless I'm missing something! Is this planned for the future? I'm happy to provide this if not - is it just a case of creating a class like Rickshaw.Graph.Axis.Time.js (maybe Rickshaw.Graph.Axis.X.js) along the same lines as Rickshaw.Graph.Axis.Y.js, that can be given the number formatter?

Thanks,
Craig

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.