You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

solid-charts-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-charts-js

Solid components for ChartJS library

1.0.9
latest
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Chart.JS powered by solid-js framework

Installation

npm i chart.js solid-js solid-chart.js

Example

import { afterEffects, createState } from "solid-js";
import SolidChart, { SolidChartProps } from "solid-chart.js";
import { render } from "solid-js/dom";
const edges = 6;
const labels = ["Solid", "Is", "Most", "Performant", "JavaScript", "Framework"];
const datasets = new Array<number[]>(edges).fill([]).map((_, i) => {
  const arr = [0, 0, 0, 0, 0, 0];
  if (i === edges - 1) {
    arr[i] = 60;
    arr[0] = 60;
  } else {
    arr[i] = 60;
    arr[i + 1] = 60;
  }
  return {
    backgroundColor: i % 2 === 0 ? "#3164A3" : "white",
    data: arr,
    label: labels[i]
  };
});
function Example() {
  const settings: SolidChartProps = {
    type: "radar",
    data: {
      labels,
      datasets
    },
    options: {
      title: {
        display: true,
        text: "SOLID CHART"
      },
      scale: {
        ticks: {
          maxTicksLimit: edges
        }
      }
    }
  };
  const [chart, setChart] = createState(settings);
  afterEffects(() => {
    setInterval(() => {
      labels.push(labels.shift());
      setChart("data", "labels", [...labels]);
      datasets.push(datasets.shift());
      setChart("data", "datasets", [...datasets]);
    }, 1400);
  });
  return (
    <SolidChart
      {...chart}
      canvasOptions={{
        width: 1000,
        height: 950
      }}
    />
  );
}
render(Example, document.getElementById("app"));

alt

Keywords

solid-js

FAQs

Package last updated on 13 Jan 2023

Did you know?

Socket

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.

Install

Related posts