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

sdmx-dashboard-components

v0.4.2

Published

Embeddable React components to create a dashboard for SDMX data. The components are built using [Vite](https://vitejs.dev/).

Downloads

9

Readme

SDMX Dashboard React Component

Embeddable React components to create a dashboard for SDMX data. The components are built using Vite.

This repository also embeds a demo application to showcase the components (more info here).

Project generated thanks to this great article: Create a Component Library Fast🚀(using Vite's library mode)

Usage

This library provides a set of components to build visuals for SDMX data. Single React components are available SDMXChart, SDMXMap and SDMXValue to embed SDMX visuals in your application and can also be combined in a SDMXDashboard component that generates a dashboard. The single components are only configured via props, while the dashboard component can configured via a JSON configuration file.

More information on the syntax of the configuration can be found here

npm install sdmx-dashboard-components
import { SDMXDashboard } from 'sdmx-dashboard-components';

const App = () => {
  return (
    // SDMX dashboard component build from JSON configuration file
    <SDMXDashboard
      url='path/to/dashboard.json'
    />
    // SDMX chart component built from props
    <SDMXChart
      config={{
        data: ["https://stats-sdmx-disseminate.pacificdata.org/rest/data/SPC,DF_WBWGI,1.0/A..VA_EST?startPeriod=2010&dimensionAtObservation=AllDimensions"],
        title: {
          text: "World Bank Worldwide Governance Indicator",
        },
        subtitle: {
          text: "Voice and Accountability"
        },
        id:"wgi_va",
        type: "drilldown",
        xAxisConcept:"TIME_PERIOD",
        legend: {
          concept: "GEO_PICT"
        },
        yAxisConcept: "OBS_VALUE"
      }}
    />
  );
};

Highcharts Styled Mode

The user can also make use of all the Highcharts options passing them as props to the components with the extraOptions parameter of the config object.

For instance, the Highcharts styledMode option can be used to apply CSS styles to the chart's elements and also leverage the dark theme. In this case, the colorPalette parameter passed to the component must be an object that specify a colorIndex and not a color code. The integrating application has to include in its CSS the highcharts classes for the indexes.

<SDMXChart
  config={{
    data: ["https://stats-sdmx-disseminate.pacificdata.org/rest/data/SPC,DF_WBWGI,1.0/A..VA_EST?startPeriod=2010&dimensionAtObservation=AllDimensions"],
    title: {
      text: "World Bank Worldwide Governance Indicator",
    },
    colorPalette: {
      "GEO_PICT": {
        "CK": 0,
        "FJ": 1,
        "FM": 2,
        "KI": 3,
        "MH": 4,
        "NC": 5,
        "PF": 8,
        "PW": 10,
        "SB": 11,
        "TO": 12,
        "VU": 14,
        "WF": 15
      }
    },
    extraOptions: {
      chart: {
        styledMode: true
      }
    }
  }}
/>
.highcharts-color-0 {
  fill: #E16A86;
  stroke: #E16A86;
}
.highcharts-color-1 {
  fill: #D7765B;
  stroke: #D7765B;
}
.highcharts-color-2 {
  fill: #C7821C;
  stroke: #C7821C;
}
...

Sorting data by value

For column-like representation (column, bar, drilldown, lollipop), the data is sorted alphabetically by default. The data can be sorted by value with the sortByValue config parameter in ascending or descending order. The sorting is done on the x-axis dimension.

<SDMXChart
  config={{
    ...
    sortByValue: "asc" | "desc"
    ...
  }}
/>

Development

npm install
npm run dev

The components are located in the lib folder where as the src folder hosts a demo application.

The vite preview mode can also be used to test the built library in the demo application.

npm run preview

Build

npm run build