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

Bar Chart transparent on the web #733

Open
willianlouza opened this issue Aug 29, 2024 · 3 comments
Open

Bar Chart transparent on the web #733

willianlouza opened this issue Aug 29, 2024 · 3 comments

Comments

@willianlouza
Copy link

The Bar Chart is transparent on the web unless i reload the page.

The home page shows the Bar Chart normally

Captura de tela de 2024-08-29 15-06-34

So if I navigate to another page which also has a Bar Chart, it displays transparent

Captura de tela de 2024-08-29 15-06-51

And when I refresh the page, the graph is displayed as it should

Captura de tela de 2024-08-29 15-06-56

"expo-router": "~3.5.18"
"react-native-chart-kit": "^6.12.0"
"react-native-svg": "^15.4.0"
"react-native-web": "~0.19.10"
"expo": "~51.0.22"
"react-native": "0.74.3"

@willianlouza
Copy link
Author

willianlouza commented Aug 29, 2024

const chartConfig: Partial<AbstractChartConfig> = {
  backgroundColor: CMEXX_COLORS.TERTIARY,
  backgroundGradientFrom: CMEXX_COLORS.TERTIARY,
  backgroundGradientTo: CMEXX_COLORS.TERTIARY,
  backgroundGradientFromOpacity: 0.2,
  backgroundGradientToOpacity: 0.1,
  color: (opacity = 1) => CMEXX_COLORS.PRIMARY,
};

....

 return (
    <View
      style={{
        marginVertical: 16,
        justifyContent: "center",
        alignItems: "center",
      }}
    >
      <Text style={{ marginBottom: 8 }}>{classificacao.nome}</Text>
      <View
        style={{
          borderWidth: 1,
          borderRadius: 6,
          borderColor: CMEXX_COLORS.PRIMARY,
        }}
      >
        <BarChart
          style={{ paddingRight: 0 }}
          data={barChartData}
          width={(Platform.OS === "web" ? screenWidth / 2 : screenWidth) - 40}
          withHorizontalLabels={false}
          height={220}
          chartConfig={{
            ...chartConfig,
            propsForLabels: {
              fontSize: RFPercentage(1.2),
              fontFamily: "SpaceMono",
            },
          }}
          withInnerLines={false}
          withCustomBarColorFromData={false}
          yAxisLabel=""
          yAxisSuffix=""
          showValuesOnTopOfBars
        />
      </View>
    </View>
  );

@hummus-erectus
Copy link

I am experiencing this too. I don't suppose you found a solution?

@willianlouza
Copy link
Author

willianlouza commented Oct 5, 2024

No. I'm using react-native-gifted-charts instead

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

2 participants