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

Horizontal lines have different width on the same chart #981

Open
trocoli96 opened this issue Jan 28, 2025 · 0 comments
Open

Horizontal lines have different width on the same chart #981

trocoli96 opened this issue Jan 28, 2025 · 0 comments

Comments

@trocoli96
Copy link

Description

For some reason, some of the horizontal lines of some charts have a different width than some of them in the same chart.

I also tried to change the rulesLength property but even it changes the width, there are still some horizontal rules that differ. It does not always happen on the same rules neither

Image

Image

This is how I am using the chart:

const data = [
  {
      "value": 1214,
      "date": "Dic '23"
  },
  {
      "value": 1882,
      "date": "Ene '24"
  },
  {
      "value": 1208,
      "date": "Feb '24"
  },
  {
      "value": 920,
      "date": "Mar '24"
  },
  {
      "value": 1503,
      "date": "Abr '24"
  },
  {
      "value": 1625,
      "date": "May '24"
  },
  {
      "value": 1370,
      "date": "Jun '24"
  },
  {
      "value": 1589,
      "date": "Jul '24"
  },
  {
      "value": 1423,
      "date": "Ago '24"
  },
  {
      "value": 1298,
      "date": "Sep '24"
  },
  {
      "value": 1346,
      "date": "Oct '24"
  },
  {
      "value": 1411,
      "date": "Nov '24"
  }
]

const handleLayout = (event: any) => {
    const { width } = event.nativeEvent.layout;
    setContainerWidth(width - 50);
  };

<GiftedLineChart
            areaChart
            data={data}
            adjustToWidth
            hideDataPoints
            lineGradient={false}
            maxValue={maxValue}
            overflowTop={0}
            height={210}
            width={containerWidth}
            showVerticalLines
            color={blue}
            thickness={2}
            startFillColor={blue[200]}
            endFillColor={blue[700]}
            startOpacity={0.9}
            endOpacity={0.2}
            isAnimated
            animationDuration={300}
            initialSpacing={0}
            disableScroll
            noOfSections={6}
            showFractionalValues={false}
            xAxisLabelTexts={data.map(item => item.date)}
            xAxisLabelsHeight={100}
            xAxisThickness={xAxisThickness}
            yAxisLabelWidth={40}
            yAxisThickness={yAxisThickness}
            yAxisLabelContainerStyle={{ justifyContent: "start" }}
            yAxisTextStyle={{ color: grey[400], marginLeft: 5 }}
            rulesType="solid"
            rotateLabel
            yAxisSide={yAxisSides.RIGHT}
            showValuesAsDataPointsText
/>

Thank you for the help in advance!

Steps to reproduce

  1. Rendered LineChart on web
  2. Have a state for the container width
  3. Horizontal lines keep having different widths

Snack or a link to a repository

No response

version of react-native-gifted-charts

1.4.56

React Native version

0.76.5

Platforms

Web

Workflow

None

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

1 participant