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

@visactor/vchart-arco-theme

v1.12.2

Published

Extended themes for VChart

Downloads

446

Readme

@visactor/vchart-arco-theme

Description

The extension ArcoDesign themes for VChart.

Introduction for ArcoDesign

Upgraded from Byte Design, a comprehensive enterprise-level product design system.

How does ArcoDesign come into being

ArcoDesign is short for a set of design system.

  • The objective of ArcoDesign is to solve the experience problems occurred when using a product with a general design system and to provide guiding principles for product design to address problems occurred during the business. At the same time, it can also promote the cooperation between design department and R&D department and serve as the communication language among developers.
  • ArcoDesign mainly serves the experience design and technical realization in the middle and back-end products of ByteDance and is mainly constructed and maintained by UED designers and developers.

Design Language - Pragmatic Romanticism

img

ArcoDesign tries to establish a working mode

Pragmatism=Empathy; Romantism=Imagination

  • First, pragmatism allows design system to solve most of the needs to greatly improve efficiency. Based on this, designers & developers can do more "romantic" things, that is, to develop more innovative and imaginative outcomes.
  • On the product side, we can not only build basic functions pragmatically through the design system, but also use it to configure some romantic product pursuits.
  • Romanticism and pragmatism is not contradictory. The philosophy of design language is derived through the definition of romanticism and pragmatism, which runs through the entire design system. They are complementary to each other to influence the design direction.

Currently, VChart provides specialized adaptation for ArcoDesign. More information about ArcoDesign can be found on the website.

Installing and Using VChart

ArcoDesign is currently mainly adapted to React projects. In React projects, you can use the following command to install react-vchart:

# npm
npm install @visactor/react-vchart
# yarn
yarn add @visactor/react-vchart

The method of drawing charts and more detailed guidance can be found in this tutorial.

Chart Theme Package for ArcoDesign

In order to provide a better experience for VChart in the Arco page environment, VisActor has launched an additional theme package called @visactor/vchart-arco-theme. This package has the following features:

  • Ready to use out of the box: With simple configuration, VChart styles can be automatically integrated into the ArcoDesign language and also automatically adapted to theme packages customized by users based on Arco.
  • Responsive: @visactor/vchart-arco-theme supports listening for changes of light/dark mode and CSS variable update on the page, and automatically updates the theme of the charts on the page.

DEMO

For a complete demo, please visit the codeSandBox page.

Installation

https://www.npmjs.com/package/@visactor/vchart-arco-theme

# npm
npm install @visactor/vchart-arco-theme

# yarn
yarn add @visactor/vchart-arco-theme

Usage

To access the default functionality, simply execute the initVChartArcoTheme method once globally for initialization. This statement can usually be placed in the entry file of a React project. As an example:

import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './app.jsx';
import { initVChartArcoTheme } from '@visactor/vchart-arco-theme';

// initialization
initVChartArcoTheme();

const dom = document.querySelector('#root');
const root = createRoot(dom);
root.render(<App />);

The initVChartArcoTheme method supports passing in an object as a parameter, whose type declaration is:

interface IInitVChartArcoThemeOption {
  /** Initial light/dark mode */
  defaultMode?: 'light' | 'dark';
  /** Whether to listen for the light/dark mode switching and automatically change the chart theme. The default setting is true */
  isWatchingMode?: boolean;
  /** Specify a ThemeManager, usually not specified. If multiple versions of vchart coexist, it needs to be specified */
  themeManager?: typeof ThemeManager;
}

Token Mapping

In terms of functional design of chart themes, VChart supports custom configuration of data palettes and semantic color palettes. Based on this feature, the combination of VChart and ArcoDesign has been implemented by @visactor/vchart-arco-theme.

Data Palette

ArcoDesign declared the corresponding token for the data palette for VChart. Users can configure the following tokens when customizing themes in DSM to customize the data palette for VChart. The data palette of charts will automatically apply these variables, and users do not need to intervene. This feature is implemented by @visactor/vchart-arco-theme.

The corresponding colors of these tokens form VChart's default 20 color palette in ArcoDesign.

As described in the document, the VChart data palette can also be dynamic and progressive. In general, the color palette will be dynamically adjusted based on the range of data item quantities. When there are no more than 10 data groups, a 10 color palette should be used; When there are more than 10 data groups, a 20 color palette is used. If there are more than 20 data groups, the palette colors will be applied repeatedly, starting from the first one.

@visactor/vchart-arco-theme will automatically draw 10 colors from the 20 color palette mentioned earlier to form a 10 color palette that is compatible with small amounts of data. The current method is to take even indexed colors, which means that the default 10 color palette consists of the color values corresponding to the following tokens:

Semantic Color Palette

In addition to the tokens mentioned earlier, @visactor/vchart-arco-theme will also automatically crawl other tokens of the current Arco theme in the page environment to generate a VChart chart theme. These tokens are mainly used for the styles of various chart components. You can refer to the following document for details:

Static resources

This package contains both static theme JSON resources (static resources only apply to the default Arco theme), which can be used on demand.

Debug

Run the following command from any location in the project to start the dev server:

rush arco