XAxis formatLabel not showing value
See original GitHub issueHey.
I’m stuck with the formatLabel prop. I want to show the date under my chart. Now it just shows the array key.
This is the array that gets returned by the this._chartXAxis() function:
["2018-02-20", "2018-02-21", "2018-02-22", "2018-02-23", "2018-02-24", "2018-02-25", "2018-02-26", "2018-02-27"]

Here’s my code:
<View style={styles.chartContainer}>
    <Card>
        <View style={styles.chart}>
            <LineChart
                style={{ flex: 1 }}
                data={this._chartStats('impressions')}
                gridMin={0}
                svg={{ stroke: '#969FAD' }}
                contentInset={{ top: 10, bottom: 10 }}
            />
            <LineChart
                style={ StyleSheet.absoluteFill }
                data={this._chartStats('clicks')}
                gridMin={0}
                svg={{ stroke: '#1E92FF' }}
                contentInset={{ top: 10, bottom: 10 }}
            />
            <LineChart
                style={ StyleSheet.absoluteFill }
                data={this._chartStats('payout')}
                gridMin={0}
                svg={{ stroke: '#FE2851' }}
                contentInset={{ top: 10, bottom: 10 }}
            />
            <LineChart
                style={ StyleSheet.absoluteFill }
                data={this._chartStats('conversions')}
                gridMin={0}
                svg={{ stroke: '#FE2851' }}
                contentInset={{ top: 10, bottom: 10 }}
            />
            <LineChart
                style={ StyleSheet.absoluteFill }
                data={this._chartStats('payout')}
                gridMin={0}
                svg={{ stroke: '#44DB5E' }}
                contentInset={{ top: 10, bottom: 10 }}
            />
            <XAxis
                style={{ marginHorizontal: -10 }}
                data={ this._chartXAxis() }
                formatLabel={(value, index) => value}
                contentInset={{ left: 10, right: 10 }}
                svg={{ fontSize: 10 }}
            />
        </View>
    </Card>
</View>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
X-axis start and end labels are not showing - Stack Overflow
To XAxis component, give contentInset value of 15 to left and right, 10 seems bit low, ... <XAxis data={data} formatLabel={(value, ...
Read more >Specify y-axis tick label format - MATLAB ytickformat
This MATLAB function sets the format for numeric y-axis tick labels. ... Display the y-axis tick labels in dollars with and without decimal...
Read more >Labeling Axes - Chart.js
Labeling Axes. When creating a chart, you want to tell the viewer what data they are viewing. To do this, you need to...
Read more >xAxis.labels.format | highcharts API Reference
The axis labels show the number or category for each tick. ... X axis labels overlap enabled ... If there is enough space,...
Read more >Solved: Split format label for xaxis values with PROC SGPLOT
Solved: I am trying to split the formmated xasix values in two lines with PROC SGPLOT but it is not working. Anybody has...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Should now be
xAccessor={({ item, index }) => item}Hey guys! You need to add the
xAccessorprop. If it’s omitted the XAxis will assume you’re only interested in the index. i.exAcessor={ ({ value }) => value }in your use cases.PS. You will probably have a problem with overlapping labels with such long strings. Check out the examples repo if you need inspiration
PPS. I see now that I’ve forgotten to update the README regarding this, I just wrote it in the release changelog 😝 Will keep this issue open as a reminder