
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@geins/ralph-module-chart-js
Advanced tools
A module for Geins PWA Storefront Ralph that adds Chart.js charts to your storefront.
This module enables you to add Chart.js charts to your storefront in seconds.
Module can be used in any page of your storefront and is configuerd to work with Geins Cart out-of-box. Module can be added via Geins CMS or any CMS of your choice.
npm i @geins/ralph-module-chart-js
Add the module to your Geins PWA Storefront Ralph by adding the following line to your nuxt.config.js
file:
// nuxt.config.js
...
modules: [
[
'@geins/ralph-module-chart-js',
{
enabled: true,
debug: true
}
]
],
Use the @geins/ralph-module-cms-json-container
npm i @geins/ralph-module-cms-json-container
Add module to your nuxt.config.json
file:
...
modules: [
'@geins/ralph-module-cms-json-container'
]
..
Set the widgetRenderTypesComponents
in your nuxt.config.json
file to use the GeinsWidgetJsonContainer
component for the JSON
widget type.
// nuxt.config.js
...
publicRuntimeConfig: {
widgetRenderTypesComponents: {
JSON: 'GeinsWidgetJsonContainer'
},
}
...
Add extra options to module configuration in nuxt.config.js
file.
| Parameter | Type | Default | Example |
|-|-|-|
| enabled | String | true
| Enables the module|
| debug | String | false
| Enables debug info to console |
| chartOptions | Object | {} | For chart-customization, add your own options object here Chart.js docs |
| chartPlugins | Array | [] | If available, add an arrray of your chart-plugins here Chart.js docs |
Add component to desired page of your storefront. Either by cms or as a component.
Module adds two components to your storefront. GeinsChartJs
and GeinsWidgetChartJs
.
This component is used to show the streamify player. It is used by the GeinsWidgetChartJs
component. You can use it directly in your page if you want to add the player directly to your page.
The properties of the component are one to one with the Chart.js API. You can add any property to the component and it will be passed to the API.
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
type | String | 'line' | No | Type of chart |
data | Object | - | Yes | Dataset and labels for your chart |
options | Object | default Chart.js options | No | Chart options |
plugins | Array | [] | No | Chart plugins |
Add a JSON Widget
to your page in the Geins CMS. Add the following JSON to your widget (replace with your own dataset and labels). Customize the values according to your own dataset and preferences.
Example of JSON widget content:
{
"renderWidget": "GeinsWidgetChartJs",
"data": {
"data": {
"labels": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
"datasets": [{
"label": "Sunlight hours per month",
"data": [197, 216, 232, 244, 248, 290, 288, 274, 268, 246, 212, 182]
}]
}
}
}
To add global customization to your charts, create a folder inside your static-folder called chartJs
. Inside this create a file called chartOptions.js
.
Inside this file, add your custom options (see below example):
// chartOptions.js
export const chartOptions = {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
border: {
display: false
},
grid: {
display: false,
drawTicks: false
}
},
x: {
border: {
display: false
},
grid: {
display: false,
drawTicks: false
}
}
}
}
See docs for Chart.js options for more options.
Import your chartOptions.js
file into your nuxt.config.js
:
import { chartOptions } from './static/chartJs/chartOptions';
Add the chartOptions to your module options:
[
'@geins/ralph-module-chart-js',
{
enabled: true,
chartOptions: chartOptions,
}
]
Add the component to your page. Add the type as properties to the component.
<GeinsChartJs
:type="chartType"
:data="chartData"
:options="chartOptions"
:plugins="chartPlugins"
/>
Add a chart to you PDP to display product meta data in a intuitive way.
FAQs
Chart.js module for Geins PWA Storefront Ralph
We found that @geins/ralph-module-chart-js 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.