Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const name = "AAPL-price";
const columns = ["time", "open", "close", "low", "high"];
const events = aapl.map(item => {
const timestamp = moment(new Date(item.date));
const { open, close, low, high } = item;
return new TimeEvent(timestamp.toDate(), {
open: +open,
close: +close,
low: +low,
high: +high
});
});
const collection = new Collection(events);
const sortedCollection = collection.sortByTime();
const series = new TimeSeries({ name, columns, collection: sortedCollection });
//
// Volume
//
const volumeEvents = aapl.map(item => {
const index = item.date.replace(/\//g, "-");
const { volume } = item;
return new IndexedEvent(index, { volume: +volume });
});
const volumeCollection = new Collection(volumeEvents);
const sortedVolumeCollection = volumeCollection.sortByTime();
const seriesVolume = new TimeSeries({
name: "AAPL-volume",
utc: false,
const name = "AAPL-price";
const columns = ["time", "open", "close", "low", "high"];
const events = aapl.map(item => {
const timestamp = moment(new Date(item.date));
const { open, close, low, high } = item;
return new TimeEvent(timestamp.toDate(), {
open: +open,
close: +close,
low: +low,
high: +high
});
});
const collection = new Collection(events);
const sortedCollection = collection.sortByTime();
const series = new TimeSeries({ name, columns, collection: sortedCollection });
//
// Volume
//
const volumeEvents = aapl.map(item => {
const index = item.date.replace(/\//g, "-");
const { volume } = item;
return new IndexedEvent(index, { volume: +volume });
});
const volumeCollection = new Collection(volumeEvents);
const sortedVolumeCollection = volumeCollection.sortByTime();
const seriesVolume = new TimeSeries({
name: "AAPL-volume",
utc: false,
return new IndexedEvent(
date,
{
temp: [
+record_min_temp, //eslint-disable-line
+actual_min_temp, //eslint-disable-line
+actual_max_temp, //eslint-disable-line
+record_max_temp //eslint-disable-line
]
},
false
);
});
const collection = new Collection(events);
const series = new TimeSeries({ name, collection });
//
// Styles
//
class nyc extends React.Component {
//eslint-disable-line
state = {
timerange: new TimeRange([1425168000000, 1433116800000]),
selection: null
};
handleTimeRangeChange = timerange => {
this.setState({ timerange });
};
{graphData.map(set => {
const series = new TimeSeries({
name: set.label,
columns: ['time', 'value'],
points: set.data,
});
const style = { value: { normal: { stroke: this.state.lineColors[set.label], strokeWidth: 2 } } };
return ;
})}
{graphData.map(set => {
const series = new TimeSeries({
name: set.label,
columns: ['time', 'value'],
points: set.data,
});
const style = { value: { normal: { stroke: this.state.lineColors[set.label], strokeWidth: 2 } } };
return ;
})}
getEvents(type) {
const e = this.props[`${type}Events`];
let data = {
name: type,
columns: ["time", "value"],
points: []
};
_.each(e, (value, key, list) => {
data.points.unshift([value.event.timestamp.getTime(), value.event.message])
});
if (data.points[0]) return new TimeSeries(data);
}
getEvents(type) {
const e = this.props[`${type}Events`];
let data = {
name: type,
columns: ["time", "value"],
points: []
};
_.each(e, (value, key, list) => {
data.points.unshift([value.event.timestamp.getTime(), value.event.message])
});
if (data.points[0]) return new TimeSeries(data);
}
getEvents(type) {
const e = this.props[`${type}Events`];
let data = {
name: type,
columns: ["time", "value"],
points: []
};
_.each(e, (value, key, list) => {
data.points.unshift([value.event.timestamp.getTime(), value.event.message])
});
if (data.points[0]) return new TimeSeries(data);
}
getEvents(type) {
const e = this.props[`${type}Events`];
let data = {
name: type,
columns: ["time", "value"],
points: []
};
_.each(e, (value, key, list) => {
data.points.unshift([value.event.timestamp.getTime(), value.event.message])
});
if (data.points[0]) return new TimeSeries(data);
}
getEvents(type) {
const e = this.props[`${type}Events`];
let data = {
name: type,
columns: ["time", "value"],
points: []
};
_.each(e, (value, key, list) => {
data.points.unshift([value.event.timestamp.getTime(), value.event.message])
});
if (data.points[0]) return new TimeSeries(data);
}