npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mindinventory/result-doughnut-chart

v1.0.0

Published

The result doughnut chart is dynamic chart component. Here we show two charts. The first is full doughnut chart when user select any colour section of first chart that time the second chart (half doughnut chart) value change based on first chart selection

Downloads

17

Readme

@mindinventory/result-doughnut-chart

The result doughnut chart is dynamic chart component.
Here we show two charts. The first is full doughnut chart when user select any colour section of first chart that time the second chart (half doughnut chart) value change based on first chart selection. Below is the JSON object we used as data for charts. So from there you can change title, colour, text, etc...

Image & video

Image: Screenshot from 2023-02-16 14-27-07

Video:

https://user-images.githubusercontent.com/108857417/219317452-a878d68c-ed76-4ce4-afdd-ff69dcdb1739.mp4

JSON

  • Here we use JSON which shows dynamic data & UI in component.
  • We can control some UI section based on set of key value as explain below.
    • Object key tipData & extraData value pass as empty array ([]).
    • Object key firstChartTipTitle & secondChartTipTitle value pass as empty string ("").

Installation

Install package.

  npm i @mindinventory/result-doughnut-chart

Examples

import Chart from "@mindinventory/result-doughnut-chart";

export const apiData = {
  firstChartDataSetLabel: "%",
  secondChartDataSetLabel: "%",
  firstChart: [
    {
      name: "Distinction",
      backgroundColor: "rgba(255, 99, 132, 0.2)",
      borderColor: "rgba(255, 99, 132, 1)",
      data: 30,
      secondChartData: [5, 15, 10],
      secondChartCenterText: "30%",
    },
    {
      name: "First class",
      backgroundColor: "rgba(54, 162, 235, 0.2)",
      borderColor: "rgba(54, 162, 235, 1)",
      data: 15,
      secondChartData: [10, 2, 3],
      secondChartCenterText: "15%",
    },
    {
      name: "Second class",
      backgroundColor: "rgba(75, 192, 192, 0.2)",
      borderColor: "rgba(75, 192, 192, 1)",
      data: 35,
      secondChartData: [7, 18, 10],
      secondChartCenterText: "35%",
    },
    {
      name: "Fail",
      backgroundColor: "rgba(153, 102, 255, 0.2)",
      borderColor: "rgba(153, 102, 255, 1)",
      data: 20,
      secondChartData: [2, 8, 10],
      secondChartCenterText: "20%",
    },
  ],
  secondChart: [
    {
      name: "Science",
      backgroundColor: "rgba(255, 99, 132, 0.2)",
      borderColor: "rgba(255, 99, 132, 1)",
    },
    {
      name: "Commerce",
      backgroundColor: "rgba(54, 162, 235, 0.2)",
      borderColor: "rgba(54, 162, 235, 1)",
    },
    {
      name: "Arts",
      backgroundColor: "rgba(75, 192, 192, 0.2)",
      borderColor: "rgba(75, 192, 192, 1)",
    },
  ],
  firstChartTipTitle: "Selected Grade:",
  secondChartTipTitle: "Result summary:",
  tipData: [
    {
      firstChartTip: "Distinction grade",
      secondChartTip: "30% students pass with distinction grade.",
    },
    {
      firstChartTip: "First grade",
      secondChartTip: "15% students pass with first grade.",
    },
    {
      firstChartTip: "Second grade",
      secondChartTip: "35% students pass with second grade.",
    },
    {
      firstChartTip: "Fail",
      secondChartTip: "20% students fail.",
    },
  ],
  labelExtraData: "Result",
  extraData: [
    {
      grade: "Distinction",
      summary: "30% students pass with distinction grade in 2022.",
      date: "January 12, 2022", //also able to append key & value
    },
    {
      grade: "First",
      summary: "15% students pass with first grade in 2022.",
      date: "January 27, 2022",
    },
    {
      grade: "Second",
      summary: "35% students pass with second grade in 2022.",
      date: "January 19,2022 ",
    },
    {
      grade: "Fail",
      summary: "20% students fail in 2022.",
      date: "January 8,2022  ",
    },
  ],
};

const App = () => {
  return <Chart data={apiData} />;
};

export default App;

License!

@mindinventory/result-doughnut-chart MIT-licensed.

Let us know!

If you use our open-source libraries in your project, please make sure to credit us and Give a star to www.mindinventory.com