Skip to content

Commit

Permalink
Setup radar-scope-js
Browse files Browse the repository at this point in the history
  • Loading branch information
bcostaaa01 committed Feb 2, 2023
0 parents commit ac4348f
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
47 changes: 47 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "radar-scope-js",
"version": "1.3.0",
"description": "Create stunning and dynamic radar charts with ease using RadarScope, the versatile open-source JavaScript library built with Chart.js. With customizable scales and multiple datasets support, bring your data to life with dynamic visuals.",
"main": "index.js",
"repository": "https://github.com/bcostaaa01/radar-scope-js.git",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
"src/**/*.js"
],
"keywords": [
"radar",
"chart",
"chartjs",
"radarscope"
],
"author": "Bruno Costa",
"license": "ISC",
"dependencies": {
"chart.js": "^4.2.0"
}
}
20 changes: 20 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Chart from "chart.js";

function createRadarChart(data, options) {
const chartId = `radar-chart-${Math.random()
.toString(36)
.substring(2, 15)}`;
const chartContainer = document.getElementById("div");
chartContainer.innerHTML = `
<canvas id="${chartId}"></canvas>
`;
const chartCanvas = chartContainer.querySelector(`#${chartId}`);
const chart = new Chart(chartCanvas, {
type: "radar",
data: data,
options: options,
});
return chartContainer;
}

export { createRadarChart };

0 comments on commit ac4348f

Please sign in to comment.