![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ember-cli-chartist
Advanced tools
This is an ember-cli wrapper for Chartist. It allows you to render Chartist charts in your templates using components.
In an existing ember-cli project. Install with:
npm install ember-cli-chartist --save-dev
In the template where you want the chart to appear:
{{chartist-chart data=model.chartData}}
The data
attribute is the only required attribute. It's value should be an object. Check the Chartist docs for expected data structure.
The data can be specified in an Ember route or controller. In the example above it's coming from the model which is defined in the route.
/app/routes/application.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function () {
return {
chartData: {
labels: ['Day1', 'Day2', 'Day3'],
series: [
[5, 4, 8],
[10, 2, 7],
[8, 3, 6]
]
}
}
}
});
There are three types of charts; line, bar, and pie. The default is line. You can change the chart type using the type
attribute.
/app/templates/application.hbs
{{chartist-chart type="bar" data=model.chartData}}
Chartist charts scale up and down in size. They do so at specified ratios. You can change the ratio using the ratio
attribute.
/app/templates/application.hbs
{{chartist-chart ratio="ct-golden-section" data=model.chartData}}
See Chartist docs for the full list of ratios and info on how to create your own.
Chartist charts have a whole bunch of cool configuration options. You can pass those to the chartist-chart
components with the options
attribute. You'll need to create the options object in a similar way as you do for the data
attribute object.
/app/templates/application.hbs
{{chartist-chart options=chartOptions data=model.chartData}}
/app/controllers/application.js
import Ember from 'ember';
export default Ember.ObjectController.extend({
chartOptions: {
showArea: true,
lineSmooth: false,
axisX: {
showGrid: false
}
}
});
See the Chartist docs for all available config options. There's bunch of good-uns!
You can also configure your charts for different media queries. All of the same
configuration options are available, but you provide them via the responsiveOptions
attribute.
{{chartist-chart responsiveOptions=resOpts data=model.chartData}}
/app/controllers/application.js
import Ember from 'ember';
export default Ember.ObjectController.extend({
chartResOptions: [
['screen and (min-width: 640px)', {
showArea: true,
lineSmooth: false,
axisX: {
showLabel: false
}
}]
]
});
By default, the compiled chartist.css
will be included in your app's vendor.css
. If you want to use custom CSS you can tell the addon to not include the compiled version
In your app's Brocfile.js
:
var app = new EmberApp({
'ember-cli-chartist': {
'useCustomCSS': true
}
});
If you want to import the Chartist scss into your app's scss, you will need to install ember-cli-sass. You can then import the Chartist scss with:
In app.scss
@import "chartist";
you can also import the Chartist settings scss:
@import "chartist-settings";
For more on custom styles see the Chartist docs
If you'd like to contribute to this project, that would be swell. Here are some details on doing that.
git clone
this repositorynpm install
bower install
ember server
ember test
ember test --server
FAQs
Ember Addon for Chartist.js
The npm package ember-cli-chartist receives a total of 168 weekly downloads. As such, ember-cli-chartist popularity was classified as not popular.
We found that ember-cli-chartist 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.