highcharts / highcharts-react-native

Other
103 stars 79 forks source link

CandleStick not rendering #112

Closed arthurgeron-work closed 3 years ago

arthurgeron-work commented 3 years ago

type: 'candlestick'does not work in react-native for some reason. I've tested my data array with examples using standard react version to no avail.

Though when I try rendering it with the series part of the options set to the code below it renders normally.


{
      //   data: [1, 3, 2],
      // },

This is a example of the way I'm trying to render it:


import React from 'react';
import HighchartsReactNative from '@highcharts/highcharts-react-native';

const styles = StyleSheet.create({
    container: {
      backgroundColor: '#fff',
      justifyContent: 'center',
      width: '100%',
      flex: 1,
    },
  });

const modules = ['data', 'exporting', 'price-indicator'];

  const data = {
    title: {
      text: 'Default title',
    },
    // tooltip: {
    //   formatter: function () {
    //     return 'Point Y: ' + this.y;
    //   },
    // },
    rangeSelector: {
      selected: 1,
    },
    series: [
      // {
      //   data: [1, 3, 2],
      // },
      {
        data: [
          [1604703600000, 19.55, 19.95, 19.54, 19.75],
          [1604692800000, 19.83, 19.83, 19.83, 19.83],
          [1604689200000, 19.83, 19.83, 19.83, 19.83],
          [1604685600000, 19.83, 19.83, 19.83, 19.83],
          [1604682000000, 19.83, 19.83, 19.83, 19.83],
          [1604678400000, 19.83, 19.83, 19.83, 19.83],
          [1604610000000, 19.9, 19.92, 19.88, 19.92],
          [1604606400000, 19.94, 19.99, 19.93, 19.98],
          [1604602800000, 19.83, 19.85, 19.8, 19.85],
          [1604599200000, 19.83, 19.83, 19.8, 19.81],
          [1604595600000, 19.8, 19.81, 19.78, 19.8],
          [1604592000000, 19.77, 19.91, 19.73, 19.77],
          [1604588400000, 19.92, 19.94, 19.87, 19.87],
          [1604584800000, 19.86, 19.89, 19.83, 19.87],
          [1604581200000, 19.95, 19.97, 19.93, 19.97],
          [1604530800000, 20.01, 20.07, 19.27, 19.72],
          [1604527200000, 19.73, 19.74, 19.7, 19.73],
          [1604523600000, 19.78, 19.83, 19.77, 19.82],
          [1604520000000, 19.78, 19.85, 19.75, 19.84],
          [1604516400000, 19.8, 19.85, 19.77, 19.79],
          [1604512800000, 19.74, 19.78, 19.73, 19.76],
          [1604509200000, 19.71, 19.72, 19.7, 19.71],
          [1604505600000, 19.45, 19.59, 19.44, 19.59],
          [1604502000000, 19.41, 19.47, 19.37, 19.41],
          [1604498400000, 19.62, 19.65, 19.58, 19.59],
          [1604494800000, 20.01, 20.04, 19.95, 20.02],
          [1604444400000, 19.51, 19.9, 19.33, 19.65],
          [1604437200000, 19.77, 19.8, 19.76, 19.8],
          [1604433600000, 19.44, 19.45, 19.43, 19.45],
          [1604430000000, 19.48, 19.49, 19.46, 19.46],
        ],
        type: 'candlestick',
        name: 'Test',
        dataGrouping: {
          units: [
            [
              'week', // unit name
              [1], // allowed multiples
            ],
            ['month', [1, 2, 3, 4, 6]],
          ],
        },
      },
    ],
  };

export default function MyChart() {
    return (
        <HighchartsReactNative
                  useCDN={true}
                  styles={styles.container}
                  options={data}
                  modules={modules}
                />
    )
}
Denyllon commented 3 years ago

Hi @arthurgeron-work ,

Thank you for contacting us, and for your report. All of the stock type series/indicators including candlestick and price-indicator require Highcharts Stock in order to work properly. For now, our official wrapper supports the Highcharts only, without the extensions like Maps, Stock, or Gantt, and currently we do not have plans to implement those module into it. Here you can find a full list of supported modules: https://github.com/highcharts/highcharts-react-native/issues/66#issuecomment-675451391

Kind regards!