Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AreaChart2 props not working #892

Closed
McFly78 opened this issue Nov 4, 2024 · 2 comments
Closed

AreaChart2 props not working #892

McFly78 opened this issue Nov 4, 2024 · 2 comments

Comments

@McFly78
Copy link

McFly78 commented Nov 4, 2024

Description

I am trying to display a Line graph with 2 lines:

  • The first line as an area graph
  • the second line as only a line using the areaChart2 props set to false

As you can see both lines are displayed as an area graph.
image

As a workaround I temporarly modified the file /LineChart/index.js in the Gift-charts-core module.
line 1492 -> if ((areaChart ?? areaChart2) && data2.length > 0) {
replaced by: if (areaChart2 && data2.length > 0) {

Also is there a way to specify specific lineGradientId and areaGradientId for each line ?

Many thanks

Steps to reproduce


import React from 'react';
import { View} from 'react-native';

import { LineChart} from "react-native-gifted-charts";

export default class MyChartTest extends React.PureComponent {
    constructor(props) {
      super(props);
    
    }
  
  render() {
    const lineData = [
      {value: 0},
      {value: 10},
      {value: 8},
      {value: 58},
      {value: 56},
      {value: 78},
      {value: 74},
      {value: 98},
    ];
    const lineData2 = [
      {value: 0},
      {value: 20},
      {value: 18},
      {value: 40},
      {value: 36},
      {value: 60},
      {value: 54},
      {value: 85},
    ];

    return (

      <View style={{borderWidth:1}}>
        <LineChart
          areaChart={true}
          areaChart2={false}
          curved
          data={lineData}
          data2={lineData2}
          height={250}
          showVerticalLines
          spacing={44}
          initialSpacing={0}
          color1="skyblue"
          color2="orange"
          textColor1="green"
          hideDataPoints
          dataPointsColor1="blue"
          dataPointsColor2="red"
          startFillColor1="skyblue"
          startFillColor2="orange"
          startOpacity={0.8}
          endOpacity={0.3}
          textShiftY={-2}
          textShiftX={-5}
          textFontSize={13}
        />
      </View>
    )
  }
}

Snack or a link to a repository

No response

version of react-native-gifted-charts

1.4.46

React Native version

0.74.4

Platforms

iOS

Workflow

React Native

@xuxiaoqian1
Copy link

AreaChart2、AreaChart3、AreaChart4、AreaChart5 props are not working。

@Abhinandan-Kushwaha
Copy link
Owner

Hi @McFly78 @xuxiaoqian1 Thanks for pointing out this issue.
It has been fixed from versions 1.4.48 onwards. Please use the latest version of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants