question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect layered-charts , when the values in second chart is zero.

See original GitHub issue

What is the problem?

The scale for chart one and chart 2 differs when the maximum value in both the data sets are different or When second area chart has maximum value like 1, 5 etc. –>

What platform?

  • Android

React Native version: 0.55.2

Code to reproduce

 render() {

   

        const data0  = [ 50, 10, 40, 95, 0, 0, 85, 91, 35, 53, 0, 24, 50, 0, 0 ]
        const data1 =  [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
        return (
            <View style={ { flexDirection: 'row', height: 200 } }>
                <AreaChart
                    style={ { flex: 1 } }
                    data={ data0 }
                    svg={{ fill: 'rgba(134, 65, 244, 0.5)' }}
                    contentInset={ { top: 20, bottom: 0 } } 
                    curve={ shape.curveNatural }
                    ticks={1}
                >
                    
                </AreaChart>
                <AreaChart
                    style={ StyleSheet.absoluteFill }
                    data={ data1 }
                    svg={{ fill: 'rgba(34, 128, 176, 0.5)' }}
                    contentInset={ { top: 20, bottom: 0 } }
                    curve={ shape.curveNatural }
                    ticks={1}
                />

            </View>
        )
    }

Uploading WhatsApp Image 2018-05-09 at 11.12.43 PM.jpeg…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sarykemmouncommented, Aug 1, 2018

Finally, I fixed it by removing contentInset={{ top: 40, bottom: 20 }}, adding yMin={0} And using custom the cy property of the decorator (react-native-svg.Circle) in case of value 0 to avoid the decorator to be cut.

0reactions
sarykemmouncommented, Aug 1, 2018

Thanks, @JesperLekland for the response. yMin didn’t solve it for me. I think that its because of this line contentInset={{ top: 40, bottom: 20 }} I must set the bottom to avoid the decorator to be cut off. Do you have any solution for it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel Charts Displaying Incorrect Values on Vertical Axis
I am creating charts in Excel 2010; when I select data and create the chart, the vertical axis amounts do not agree with...
Read more >
Keeping specific Y-Axis order/sort in Altair for Layered Charts
This is a known bug in sorting + layering within Altair/Vega-Lite. It has been fixed upstream in Vega-Lite (see vega-lite#2177), ...
Read more >
The Effects of Chart Size and Layering on the Graphical ...
The first graph is a filled line chart — a line chart with the area between the data value on the line and...
Read more >
st.altair_chart - Streamlit Docs
You can do this by creating layered charts, which let you overlay two different charts on top of each other. The idea is...
Read more >
Multi-View Composition / UW Interactive Data Lab | Observable
However, this is pretty misleading as it aggregates the measurements ... By default, layered charts use a shared domain: the values for the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found