1.0.1 • Published 7 years ago

native-highcharts-wrapper v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Highcharts Wrapper

A react-native wrapper module for highcharts.

Note

A modified version of this module. Native-highcharts-wrapper works better for dynamic data coming from API calls since the previous module/highcharts implementation would not accept data within the configuration that was null.

Installation

npm install native-highcharts-wrapper

Demo

npm.io

Example Implementation

render() {
  var Highcharts='Highcharts';
  const exampleConfig = {
      chart: {
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,
          type: 'pie'
      },
      title: {
          text: 'Browser market shares January, 2015 to May, 2015'
      },
      tooltip: {
          pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
      },
      plotOptions: {
          pie: {
              allowPointSelect: true,
              cursor: 'pointer',
              dataLabels: {
                  enabled: true,
                  format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                  style: {
                      color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                  }
              }
          }
      },
      series: [{
          name: 'Brands',
          colorByPoint: true,
          data: [{
              name: 'Microsoft Internet Explorer',
              y: 56.33
          }, {
              name: 'Chrome',
              y: 24.03,
              sliced: true,
              selected: true
          }, {
              name: 'Firefox',
              y: 10.38
          }, {
              name: 'Safari',
              y: 4.77
          }, {
              name: 'Opera',
              y: 0.91
          }, {
              name: 'Proprietary or Undetectable',
              y: 0.2
          }]
      }]
  }
  return (
    <ChartView style={{height:400}} config={exampleConfig}></ChartView>
  );
}

Example Results

npm.io

Props

PropRequiredDescription
configtrueHighcharts configuration See the docs.>>
stockfalseDefault false; use Highstock
stylefalseStyle object to be passed onto the WebView