Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
chartjs-colorful
Advanced tools
Be colorful Chart.js v3.
yarn add chart.js chartjs-colorful
npm install --save chart.js chartjs-colorful
import Chart from 'chart.js/auto';
import { ColorfulScale, ColorfulPlugin } from 'chartjs-colorful';
import { defaultConverter } from 'chartjs-colorful/helpers';
import { linears, schemes } from 'chartjs-colorful/registries';
import { getD3Schemes, getOfficeSchemes } from 'chartjs-colorful/schemes';
// register scale and plugin.
Chart.register(ColorfulScale, ColorfulPlugin);
// add custom scheme
schemes.add('custom', ['#F00', '#FF0', '#0F0', '#0FF', '#00F', '#F0F']);
// add hue-rotate color.
// select key color and get 12 colors.
// NOTE createColors's 3rd argument is 'false' because rotateLinear(0) and rotateLinear(1) are the same color.
const rotateLinear = createRotateLinear('#ff7f7f');
schemes.add('rotate', createColors(rotateLinear, 12, false));
// get schemes and register.
const { namedColors: d3Schemes } = getD3Schemes();
schemes.addAll(d3Schemes);
schemes.addAll(getOfficeSchemes());
// get lininers and register.
const { namedLinear } = getD3Schemes();
linears.addAll(namedLinear);
const options = {
plugins: {
colorful: {
// set scheme name
colors: 'custom',
// or set scheme(=string[])
// colors: ['#F00', '#FF0', '#0F0', '#0FF', '#00F', '#F0F'],
// set converter. (alpha:0.5)
converter: defaultConverter,
}
}
}
const options = {
plugins: {
colorful: {
data: [{
// linear name.(optional)
linear: 'Turbo',
// dataset index.
datasetIndex: 0,
// value field and minimum-maximum value.
value: 'r',
min: 0,
max: 50,
// colorful scale name.
axis: 'r',
}]
}
}
}
const options = {
plugins: {
colorful: {
dataset: [ {
types: ['pie', 'doughnut', 'polarArea'],
borderColor: 'colors',
backgroundColor: 'gradients',
hoverBackgroundColor: 'colors',
}, {
types: ['bar', 'line'],
borderColor: 'color',
backgroundColor: 'gradient',
pointBackgroundColor: 'color',
hoverBackgroundColor: 'color',
}, {
types: ['radar'],
borderColor: 'color',
backgroundColor: 'gradient',
pointBackgroundColor: 'color',
}, {
// default=(other type)
borderColor: 'color',
backgroundColor: 'color2',
hoverBackgroundColor: 'color',
},
]
}
}
}
import { schemes } from 'chartjs-colorful/registries';
import { schemeTableau10 } from 'd3-scale-chromatic';
// Add a scheme(=string[]) with a suitable name.
schemes.add('Tableau10', schemeTableau10);
import { schemes } from 'chartjs-colorful/registries';
import { getBrewerSchemes, getD3Schemes, getOfficeSchemes, getTableauSchemes } from 'chartjs-colorful/schemes';
// from chartjs-plugin-colorschemes
schemes.addAll(getBrewerSchemes());
schemes.addAll(getOfficeSchemes());
schemes.addAll(getTableauSchemes());
// from d3-scale-chromatic
schemes.addAll(getD3Schemes().namedColors);
FAQs
Be colorful Chart.js v3.
The npm package chartjs-colorful receives a total of 1 weekly downloads. As such, chartjs-colorful popularity was classified as not popular.
We found that chartjs-colorful demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.