Data visualization library
A library that helps theme data visualizations with Paste tokens.
This package is meant to be used with another data visualization library to style visualizations.
yarn add @twilio-paste/data-visualization-library - or - yarn add @twilio-paste/core
This is a React Hook to take a Highcharts config and add Paste colors and fonts.
import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';
import {usePasteHighchartsTheme} from '@twilio-paste/data-visualization-library';
const LineChartOptions = {
title: {text: 'Solar Employment Growth by Sector, 2010-2016'},
subtitle: {text: 'Source: thesolarfoundation.com'},
series: [
{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],
},
{
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434],
},
{
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387],
},
{
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227],
},
{
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111],
},
],
};
const LineChartExample = () => {
const themedLineChartOptions = usePasteHighchartsTheme(LineChartOptions);
return <HighchartsReact highcharts={Highcharts} options={themedLineChartOptions} />;
};
The hook adds the following styles:
colors
: the colors Highcharts cycles through for the chart's serieschart
: the background colortitle
,subtitle
,legend
,credits
,label
, andtooltip
: the font, text colors, and background colorxAxis
,yAxis
: the font, text colors, and the line and tick colors.
To learn more about the configurations available, check out the Highcharts API documentation.
Changelog
733709127
#3395 Thanks @SiTaggart! - Modified the compile target of our JavaScript bundles fromnode
tobrowser
to minimize the risk of clashing with RequireJS. This is marked as a major out of an abundance of caution. You shouldn't need to do anything but we wanted you to be aware of the change on the off chance it has unintended consequences
- Updated dependencies [
733709127
]:- @twilio-paste/color-contrast-utils@5.0.0
- @twilio-paste/design-tokens@10.0.0
- @twilio-paste/animation-library@2.0.0
- @twilio-paste/styling-library@3.0.0
- @twilio-paste/theme@11.0.0
- @twilio-paste/types@6.0.0
3ab2bb6f4
#3114 Thanks @SiTaggart! - ### Breaking changeWe have moved
@types/react
and@types/react-dom
to peer dependencies of the library. This should allow for greater control and backwards compatibility with older versions of React as Paste is no longer bundling the type libraries.Your application likely has both of these as dependencies anyway, but it is now up to you to manage that version number.
Action needed
Ensure
@types/react
and@types/react-dom
are installed as dependencies of your application.
- Updated dependencies [
bce889344
,3ab2bb6f4
]:- @twilio-paste/theme@10.0.0
- @twilio-paste/types@5.0.0
- Updated dependencies [
dbd9bf992
,3c89fd83d
,0acdf3486
,ef094db4a
,0acdf3486
]:- @twilio-paste/design-tokens@9.0.0
- @twilio-paste/animation-library@1.0.0
- @twilio-paste/styling-library@2.0.0
- @twilio-paste/theme@9.0.0
- @twilio-paste/types@4.0.0
- @twilio-paste/color-contrast-utils@4.0.0
a4c9e70b0
#2763 Thanks @shleewhite! - Update ESLint rules, which changed some formatting.
- Updated dependencies [
364083627
,364083627
,364083627
,364083627
]:- @twilio-paste/design-tokens@8.0.0
- @twilio-paste/theme@8.0.0
- @twilio-paste/color-contrast-utils@3.0.0
ae9dd50f
#2466 Thanks @TheSisb! - [All packages] Update our ESBuild version and remove minification of identifiers in our production builds.
- Updated dependencies [
09762f0f1
,09762f0f1
]:- @twilio-paste/styling-library@1.0.0
- @twilio-paste/theme@7.0.0
73c596919
#2269 Thanks @SiTaggart! - Fixed a regression with the compilation script that caused incompatible ESM module importing of JSON files.
33c43687
#2236 Thanks @shleewhite! - [Data Visualization] add changelog
f696cb17e
#2200 Thanks @TheSisb! - [data-visualization] Add new package@twilio-paste/data-visualization-library
which exports a React hook to theme Highcharts.
c867e3f48
#2237 Thanks @SiTaggart! - Updated a build dependency (esbuild) which changes the output of our builds slightly, without materially changing anything about the code.