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

@material-vega/material-ui

v0.2.1

Published

Material UI integrations for Material Vega visualizations

Downloads

307

Readme

@material-vega/material-ui

Render Vega Lite and Vega charts with Material Design themes in Material UI projects.

Helps create Vega charts that look like Material Design's data visualizations.

Install

Using npm:

npm install react vega vega-lite react-vega @material-ui/core @material-vega/core @material-vega/material-ui

Using yarn:

yarn add react vega vega-lite react-vega @material-ui/core @material-vega/core @material-vega/material-ui

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { MuiVegaLite } from '@material-vega/material-ui';

ReactDOM.render(
  <MuiVegaLite spec={spec} variant="verticalBarChart" />,
  document.getElementById('container')
);

API

overrideColorSchemes()

Override vega.scheme's built-in categorical color schemes with similar color schemes that use MUI's color palette.

Please note that this registers the color schemes in the global vega.scheme and cannot be undone.

useMuiVegaOptions(prefs)

Get an object with createTheme options based on the Material UI theme.

Prefs:

  • color (default=primary, enum={primary, secondary, error, warning}): Default color for single value charts. This color will come from the MUI theme and can be switched between different parts of the palette.
  • background (default=transparent, enum={transparent, paper, default}): Default color for the chart background. paper and default will take the respective color from palette.background in the MUI theme.

<MuiVega>

  • variant (required): Material Vega has a limited set of themes targeted for specific types of visualizations. One of the Theme Types from @material-vega/core must be provided as the variant. (See list)
  • color (default=primary, enum={primary, secondary, error, warning}): Default color for single value charts. This color will come from the MUI theme and can be switched between different parts of the palette.
  • background (default=transparent, enum={transparent, paper, default}): Default color for the chart background. paper and default will take the respective color from palette.background in the MUI theme.
  • themeOptions: Override options passed to @material-vega/core's createTheme options. (See options)
  • TooltipComponent: Override the built-in MuiVegaTooltipComponent with a different Tooltip component.
  • Additional props are passed on to react-vega. See their documentation on what props the <Vega> component accepts.

<MuiVegaLite>

<MuiVegaLite> is a simple wrapper with the same options as <MuiVega> but takes Vega Lite visualizations instead of Vega visualizations.

Theme / Options

Material Vega options will be automatically set based on properties from the Material UI theme. These primarily ensure your charts follow the MUI theme you create but there are also a few custom theme props that can be used to change chart options globally.

  • font: theme.typography.fontFamily
  • labelPadding: theme.spacing(1)
  • textColor: theme.palette.text.primary
  • secondaryTextColor: theme.palette.text.secondary
  • dividerColor: theme.palette.divider
  • color: theme.palette[color].main based on the color prop
  • background: theme.palette.background[background] based on the background prop
  • barCornerRadius: theme.shape.barCornerRadius

Tooltip

@material-vega/material-ui includes a built-in Material UI based Tooltip component that replaces the default Vega Tooltip. TooltipComponent can be used to override the tooltip with a different React component. Or react-vega's tooltip prop can be used to override the tooltip with a non-React tooltip handler.