
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
@d3-charts/ts-graph
Advanced tools
a time series graph using D3.js.
npm i @d3-charts/ts-graph -S
import { random } from 'lodash';
import TsGraph from '@d3-charts/ts-graph';
import '@d3-charts/ts-graph/dist/index.css';
function generateSeries(seriesCount = 1000) {
const series = [];
for (let n = 1; n <= seriesCount; n++) {
const seriesData = [];
const seriesDataCount = random(99, 100);
for (let m = 1; m <= seriesDataCount; m++) {
seriesData.push({
timestamp: 1502266250000 + (m * 10000),
value: random(0, 1000, 3),
marker: {
enabled: true,
radius: 1,
}
});
}
series.push({
name: `serie-${n}`,
data: seriesData,
});
}
return series;
}
new TsGraph({
timestamp: 'x',
xkey: 'timestamp',
ykey: 'value',
chart: {
renderTo: document.getElementById(`content`),
},
series: generateSeries(),
})
const defaultOptions = {
ratio: window.devicePixelRatio || 1,
xkey: 0, // time keyName
ykey: 1, // value keyName
timestamp: 'x', // timestamp type x: Unix Millisecond, X: Unix
chart: {
id: uniqueId('d3-graph-'),
colors: ['#3399CC', '#CC9933', '#9966CC', '#66CC66', '#CC3333', '#99CCCC', '#CCCC66', '#CC99CC', '#99CC99', '#CC6666', '#336699', '#996633', '#993399', '#339966', '#993333'],
renderTo: userOptions.chart.renderTo,
width: userOptions.chart.renderTo.offsetWidth,
height: userOptions.chart.renderTo.offsetHeight || 350,
marginTop: 10,
marginRight: 10,
marginBottom: 10,
marginLeft: 10,
},
xAxis: {
lineColor: '#ccc',
lineWidth: 1,
tickLength: 5,
tickpadding: 5,
tickColor: '#ccc',
labels: {
color: '#999',
fontSize: 11,
},
},
yAxis: {
lineColor: '#ccc',
lineWidth: 1,
tickLength: 5,
tickpadding: 5,
tickColor: '#ccc',
gridLineColor: '#efefef',
labels: {
color: '#999',
fontSize: 11,
style: {
fontSize: 11,
color: '#999',
},
},
plotLines: [{
value: 100,
color: 'red',
}],
},
tooltip: {
shared: true,
formatter: undefined, // 自定义 tooltip 内容 undefined | (points) => StringOfHTML
},
series: [] // { name: string, data: any[] }[],
exemplars: [] // { name: string, data: any[] }[],
fillNull: undefined,
onZoom: () => {},
}
FAQs
a time series graph using D3.js
The npm package @d3-charts/ts-graph receives a total of 125 weekly downloads. As such, @d3-charts/ts-graph popularity was classified as not popular.
We found that @d3-charts/ts-graph demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.