Code Monkey home page Code Monkey logo

visa / visa-chart-components Goto Github PK

View Code? Open in Web Editor NEW
135.0 21.0 26.0 35.17 MB

Visa Chart Components (VCC) is an accessibility focused, framework agnostic set of data experience design systems components for the web. VCC attempts to provide a toolset to enable developers to build equal data experiences for everyone, everywhere.

Home Page: https://visa.github.io/visa-chart-components/

License: MIT License

JavaScript 4.72% SCSS 1.57% TypeScript 90.55% HTML 0.38% CSS 0.87% R 0.89% Jupyter Notebook 0.20% Python 0.54% MDX 0.28%
visualization data-visualization d3 stencil charts graphs accessibility data-experience

visa-chart-components's Introduction

Visa Chart Components

Image showing three examples of Visa Chart Components for demonstration purposes only.

Visa Chart Components (VCC) is an accessibility focused, framework agnostic set of data experience design systems components for the web. VCC attempts to provide a toolset to enable developers to build equal data experiences for everyone, everywhere.

Visa Chart Components (VCC) is provided under the MIT license.


Installation Process:

To use VCC in your projects run yarn add @visa/charts, or you can also install a single component by running yarn add @visa/bar-chart. We recommend leveraging bundles if you are going to install three (3) or more specific components for your project.

While we do deliver React (@visa/charts-react) and Angular (@visa/charts-angular) bundles, VCC components are compiled to standard web components within (@visa/charts), leveraging Stencil.js and can be reused directly in many web environments and/or frameworks.

Bundles

Components with Ready status

Our utilities can also be leveraged directly


Development

VCC is built as a monorepo containing a set of packages. These packages include specific chart components (e.g., @visa/bar-chart), our utilities (e.g., @visa/visa-charts-utils) as well as component bundles (e.g., @visa/charts or @visa/charts-react).

Steps to get up and running for development

note: the initial install and build process can take some time.

  • Clone the repo
  • run yarn install
  • run yarn dev --i to install the monorepo
  • run yarn dev --b to build the packages across the monorepo
  • You can also run yarn dev --bR to build & copy the @visa/charts bundle to our R wrapper.

Single component development

For development work on a single component, we launch local stencil applications, which allow for faster development iterations and features like hot reloading. To run a single component development environment run the below command. Note: these local/dev applications are not included in our builds.

yarn dev --ibsw=@visa/<component-name>

The switches in the command relate to:

  • i = install the component
  • b = build the component
  • sw = start watching the component

You can run --ibsw, --bsw, or --sw if you need to. You can also build packages together (once installed) using commands like:

yarn build --scope=@visa/visa-charts-utils && yarn build --scope=@visa/bar-chart

This can helpful if you are making changes to dependencies of the chart component, for example, our utilities package.


Running unit tests

We have built extensive unit testing out for some of our components and are working towards propagating this across the rest. To run unit tests the command is:

  • test all components at once: yarn dev --t
  • test a specific component: yarn dev --test=@visa/<component-name>

Also, in some cases, component snapshots may need to be updated after changes have been implemented on components themselves (take caution when updating testing snapshots). In this situation, run the update snapshot command as follows:

yarn dev --updateSnapshot=@visa/<component-name>

Once you have finished running your tests you can leverage the below scripts to evaluate them:

  • yarn combine-test-results - This script will combine all tests results across the monorepo, both coverage and test summary/failures.
  • yarn compare-test-results - This script will do a snapshot test of your test results to the current snapshot.
  • yarn update-test-results - This script will update the combined test snapshot, useful in situations when you have added more tests, cleaned up tests or enabled new components.

We use vscode as our development environment, you can also leverage the built in debugging capability in this tool to evaluate the unit tests themselves.


Running components through yarn audit / dependency check

We enable a repo wide scan using yarn audit to check for known dependency vulnerabilities. To run the audit command(s):

  • all components: yarn dev --a=ALL
  • OR, component specific: yarn dev --a=@visa/<component-name>

Once you have finished running your audit you can leverage the below scripts to evaluate the results:

  • yarn combine-audit-results - This script will combine all audit results across the monorepo.
  • yarn compare-audit-results - This script will do a snapshot test of your audit results to the current snapshot.
  • yarn update-audit-results - This script will update the combined audit snapshot, useful in situations when you have added more dependencies, cleaned up dependencies or enabled new components.

Cleaning the repo

caution: this will require you to re-install the entire monorepo, which can take some time

To clean repo we have clean command with options

yarn dev --c=<options>

Here, <options> can be

ALL-- deletes all lock files, node_modules and build folders.

LOCK-- deletes only lock files.

BUILD-- deletes only build folders and files.

NODE-- deletes only node_modules folder across repo.


Credits

You can find license information for all dependencies included in our build here. Below is a list of key dependencies.

This project was/is built with tireless efforts from:

visa-chart-components's People

Contributors

chris-demartini avatar david-kutas avatar frank-elavsky avatar jaime-tanner avatar steph-modica avatar w-kostelecki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visa-chart-components's Issues

Improve group focus indicator

Hi!

The group focus indicator isn't great (especially for scatter, line, and clustered bars).

I'm talking about this:
Screenshot 2023-08-30 at 7 26 52 PM

I've got a suggested solution: filters. You're already using them for text and geometries - it's the dual-outline strategy (and white outline on text). We can use that same strategy to create some great looking group focus indicators. On focus, you'd apply the filter to a special group appended at the end of the chart (the group doesn't need to be appended on focus, just change the href values).

This "top" group contains <use> elements, which simply reference the group or element you want to duplicate:
Screenshot 2023-08-30 at 7 02 51 PM

Like this:

<g filter="url(#VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision)">
    <use href=""></use>
    <use href=""></use>
</g>

Here's what it would look like if you group stuff up like this and apply a filter to the group:
Screenshot 2023-08-30 at 7 13 03 PM

The code for the filter looks like this:

<filter id="VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision" class="VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision">
    <feMorphology in="SourceAlpha" result="dilatedText" operator="dilate" radius="10"></feMorphology>
    <feFlood flood-color="#ffffff" flood-opacity="1" result="whiteTextFlood"></feFlood>
    <feComposite in="whiteTextFlood" in2="dilatedText" operator="in" result="textOutline"></feComposite>

    <feMorphology in="SourceAlpha" result="dilatedBlack" operator="dilate" radius="11.5"></feMorphology>
    <feFlood flood-color="#000" flood-opacity="1" result="blackFlood"></feFlood>
    <feComposite in="blackFlood" in2="dilatedBlack" operator="in" result="blackOutline"></feComposite>

    <feMerge>
        <feMergeNode in="blackOutline"></feMergeNode>
        <feMergeNode in="textOutline"></feMergeNode>
        <feMergeNode in="SourceGraphic"></feMergeNode>
    </feMerge>
</filter>

You can obviously change the radius values to whatever:
Screenshot 2023-08-30 at 7 16 11 PM

Here are some examples:
Screenshot 2023-08-30 at 7 08 01 PM
Screenshot 2023-08-30 at 7 11 45 PM
Screenshot 2023-08-30 at 7 14 18 PM

Of course, you can just show the filter effect on only the geometry group if you want, just don't add a <use> element for the text:
Screenshot 2023-08-30 at 7 15 02 PM

And for line, you have 3 elements (line, dot group, text):
Screenshot 2023-08-30 at 7 23 27 PM

I think this is quite an aesthetic improvement and also improves accessibility. The bounding-box style focus indicator just isn't great (I wonder who designed that...).

(Oh, and as a note: when we hover and get that dotted line effect? The components are currently accomplishing this with filters and fill effects on a duplicated element. It would actually be an improvement to copy my above solution and have a <g> element that contains <use> elements here too, and you just have to update the reference id (and add the fancy fill/filter effects to the <use> element). It's not a big deal, since the current system works. But this reduces render/draw time and only requires a paint update instead.)

Alluvial Chart Frequency Values

The frequency values in the final Alluvial html file are missing. This issue can be replicated by viewing the Alluvial chart provided by the package's code sample.

Self-Contained HTML File

You cannot save an object of class visaNodeLinkChart as a self-contained html file using the saveWidget function from the htmltools pkg; is there a reason for this? I know there are several js-based files that drive the creation of the plot, but it would really be nice if there was a way to save an object of class visaNodeLinkChart as a self-contained html file.

Angular 16 support

Considering the @visa/charts-angular package was built in angular 14 and updates since then have broken the components in angular 16.

No matter what chart I use from the package I get these errors in the console.

image

Visualize dispersion

I love how the Visa Chart Components incorporate best practices for accessibility, e.g. always provide a table representation of the data. But as soon as the components are used for inference rather than description, VCC lacks a good way to visualize the dispersion of data, e.g. via confidence intervals around point estimates. This could be implemented as error bars around bar charts or bands/ribbons around line charts.

Providing information about the variance / standard error besides a variable's mean is considered best practice in the communication of statistical results and I would love to see that implemented for VCC.

Alluvial Chart Colorization Documentation

It is not clear how to change the colorization of the Alluvial streams in an Alluvial chart. Can you provide additional documentation code specific to chart colorization, and more specifically, an Alluvial chart?s? Code samples should be specific, not just a reference made to a general argument list. If it is not possible to change the color, would you consider adding an argument to change alluvial color streams?

Need documentation for Annotation special features

The annotations section of the utils readme is okay: https://github.com/visa/visa-chart-components/tree/master/packages/utils#annotations

But the util has a specific feature (that you can add/subtract using nested arrays) that is not documented anywhere.
This example is powerful and custom to the annotation util wrapper that is built into VCC (Susie Lu's documentation will not teach this feature): x: [["category1"],["category2]]

(That example will calculate the pixel value of category2 and subtract it from the calculated pixel value of category1.)

Not only that, but the only explanation of the special features of the util are shown in comments in the example code snippet. It would be nice if there was a table that shows valid things that could be passed to each property (and which properties take precedence over others, such as x: versus data:).

In addition to this missing piece of documentation in the utils, the documentation in each component only points to d3-annotation by Susie Lu. It does not point to the utils doc (which has additional examples).
Bar chart: https://github.com/visa/visa-chart-components/tree/master/packages/bar-chart#annotation-props

Package Json wrong

I wont to include your npm modules directly as esm but your package json is wrong.

the export: "module" points to "dist/index.js"
wich has this code:

  export * from './esm-es5/index.js'; 

but the index.js in esm-es5 is empty

Not rendering on Voila

Could you please take a look at this issue?

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'ChartModel' from module '@visa/charts-python' is loaded but can not be instantiated
TypeError: i._deserialize_state is not a function
at tn._make_model ()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.