
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
clay-charts
Advanced tools
Metal.js wrapper for D3 and billboard.js
Install NodeJS >= v0.12.0 and NPM >= v3.0.0, if you don't have it yet. You can find it here.
Install local dependencies:
npm install
npm run build
clay-charts supports the following (billboard.js) charts:
To create a chart, you will need to instantiate the type of chart you want to use, passing in the required options:
For example, to create a LineChart
you could use the following code:
const lineChart = new metal.LineChart({
columns: [
{
data: [30, 200, 100, 400, 150, 250],
id: 'sample_data_1',
name: 'Data 1',
},
{
data: [50, 20, 10, 40, 15, 25],
id: 'data2'
},
{
data: [150, 90, 30, 400, 15, 205],
id: 'data3'
},
{
data: [10, 30, 130, 200, 50, 20],
id: 'data4'
}
]
});
As shown above, the only required option is to pass a columns
array, which contains your datasets.
Each item in the columns
array is an object which contains these fields:
{
data: [10, 20, 30, 40, 50], // {!Array} The item's dataset
id: 'data1', // {!String} The item's ID (displayed in the chart's legend and tooltip)
name: '' // {String} [optional] The item's name (If specified,
// will be displayed instead of the item's ID in the chart's legend and tooltip)
}
These options work with all supported chart types.
Please note that for DonutChart
, GaugeChart
and PieChart
the column's items contain only one value in their data
property:
const pieChart = new metal.PieChart({
columns: [
{
data: [30],
id: 'data1'
},
{
data: [50],
id: 'data2'
},
{
data: [20],
id: 'data3'
}
]
});
Additional options can be passed to the different chart constructors; these options will be passed to billboard.js
.
For all available chart options, you might want to check billboard.js
's available Options
These are the options available in clay-charts, some have slightly different names than the ones in billboard.js
+ area // Only for area type charts
+ axisRotated
+ axisX
+ axisY2
+ axisY
+ bar
+ color
+ colors
+ colorFormatter // Set's billboard.js' data.color config
+ columns
+ donut // Only for DonutChart
+ emptyLabelText
+ gauge // Only for GaugeChart
+ grid
+ groups // Set's billboard.js' data.group config
+ hide // A boolean indicating if the chart should be hidden
+ intersection
+ json // Set's billboard.js' data.json config
+ keys // Set's billboard.js' data.keys config
+ labels // Set's billboard.js' data.labels config
+ legend // Set's billboard.js' data.labels config
+ line // Only for Line type charts
+ mimeType // Set's billboard.js' data.mimeType config
+ order // Set's billboard.js' data.order config
+ padding
+ pie // Only for PieChart
+ point
+ regions
+ resizeAuto
+ rows // Set's billboard.js' data.rows config
+ selection // Set's billboard.js' data.selection config
+ size // Set's the chart's size
+ splineInterpolationType // For Spline type charts
+ subchart
+ svgClassName // Set's the `svg` element's css class name
+ title
+ tooltip
+ transitionDuration
+ url
+ x // Set's billboard.js' data.x config
+ xFormat // Set's billboard.js' data.xFormat config
+ xLocaltime // Set's billboard.js' data.xLocaltime config
+ xSort // Set's billboard.js' data.xLocaltime config
+ zoom
All these options are commented and visible in ChartBase.js.
We'd love to get contributions from you! Please, check our Contributing Guidelines to see how you can help us improve.
FAQs
Metal.js wrapper for D3 and billboard.js
The npm package clay-charts receives a total of 170 weekly downloads. As such, clay-charts popularity was classified as not popular.
We found that clay-charts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.