feat(plugins/community/stock): migrate to d3
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -31,17 +31,7 @@ export default async function({login, q, imports, data, account}, {enabled = fal
|
|||||||
|
|
||||||
//Generating chart
|
//Generating chart
|
||||||
console.debug(`metrics/compute/${login}/plugins > stock > generating chart`)
|
console.debug(`metrics/compute/${login}/plugins > stock > generating chart`)
|
||||||
const chart = await imports.chartist("line", {
|
const chart = imports.Graph.timeline(close.map((y, i) => ({x:new Date(timestamp[i]*1000), y})), {low:Math.min(...close), high:Math.max(...close), points:false, text:false, width: 480 * (1 + data.large), height:200})
|
||||||
width: 480 * (1 + data.large),
|
|
||||||
height: 160,
|
|
||||||
showPoint: false,
|
|
||||||
axisX: {showGrid: false, labelInterpolationFnc: (value, index) => index % Math.floor(close.length / 4) === 0 ? value : null},
|
|
||||||
axisY: {scaleMinSpace: 20},
|
|
||||||
showArea: true,
|
|
||||||
}, {
|
|
||||||
labels: timestamp.map(timestamp => new Intl.DateTimeFormat("en-GB", {month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit"}).format(new Date(timestamp * 1000))),
|
|
||||||
series: [close],
|
|
||||||
})
|
|
||||||
|
|
||||||
//Results
|
//Results
|
||||||
return {chart, currency, price, previous, delta: price - previous, symbol, company, interval, duration}
|
return {chart, currency, price, previous, delta: price - previous, symbol, company, interval, duration}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ inputs:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: no
|
default: no
|
||||||
extras:
|
extras:
|
||||||
- metrics.npm.optional.chartist
|
- metrics.npm.optional.d3
|
||||||
- metrics.api.yahoo.finance
|
- metrics.api.yahoo.finance
|
||||||
|
|
||||||
plugin_stock_token:
|
plugin_stock_token:
|
||||||
|
|||||||
Reference in New Issue
Block a user