Skip to content

Commit

Permalink
spline crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjennings committed May 13, 2015
1 parent d314644 commit b71f9f5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eon-chart",
"version": "0.2.6",
"version": "0.2.7",
"homepage": "https://github.com/pubnub/eon-chart",
"authors": [
"Ian Jennings <ian@meetjennings.com>"
Expand Down
4 changes: 1 addition & 3 deletions examples/spline.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
eon.chart({
history: false,
channel: "c3-spline",
flow: {
duration: 100
},
flow: true,
generate: {
bindto: '#chart',
data: {
Expand Down
4 changes: 1 addition & 3 deletions examples/super_spline.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
eon.chart({
history: true,
channel: "c3-super-spline",
flow: {
duration: 1
},
flow: true,
generate: {
bindto: '#chart',
data: {
Expand Down
10 changes: 6 additions & 4 deletions pubnub-c3.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ eon.c = {
options.generate = options.generate || {};
options.flow = options.flow || false;
if(options.flow) {
options.flow = {};
options.flow.length = options.flow.length || 0;
}
options.limit = options.limit || 10;
Expand Down Expand Up @@ -142,6 +143,8 @@ eon.c = {

buffer = self.chart.data();

console.log(buffer)

var i = 0;

while(i < buffer.length) {
Expand Down Expand Up @@ -231,16 +234,15 @@ eon.c = {

if(options.flow) {

if(options.flow === true) {
options.flow = {};
}

var trimLength = needsTrim();

if(trimLength) {
options.flow.length = trimLength;
}

// we can't animate because of a bug in c3
options.flow.duration = 0;

options.flow.columns = lastData;

self.chart.flow(options.flow);
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Parameter | Value | Default
| channel | Your [PubNub channel name](http://www.pubnub.com/docs/javascript/overview/data-push.html). | ```false```
| generate | Your [C3 chart generation config](http://c3js.org/gettingstarted.html#generate). | ```undefined```
| rate | How many milliseconds before you | ```10```
| flow | C3 flow configuration. You should only be concerned with ```flow.duration``` which will adjust how long the animation between updates lasts. | ```{duration: 100}```
| flow | Used to update spline charts over time series. | ```true```
| limit | The size of your buffer. How many values to display on the chart before shifting the first value off and appending a new value. This is not native to C3. | ```10```
| history | Fill the buffer by using PubNub history call to retrieve last ```limit``` messages. Requires [PubNub storage](http://www.pubnub.com/how-it-works/storage-and-playback/) to be enabled. | ```false```
| message | A function to call everytime a PubNub message is recieved. See [PubNub subscribe](http://www.pubnub.com/docs/javascript/api/reference.html#subscribe) | function(message, env, channel){} |
Expand Down

0 comments on commit b71f9f5

Please sign in to comment.