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.

y.ticks is not a function

See original GitHub issue

I use YAxis as code:

 <View style={{ flexDirection: 'row', height: 200, paddingVertical: 16 }}>
                <YAxis
                    data={data}
                    yAccessor={({ index }) => index}
                    scale={scale.scaleBand}
                    contentInset={{ top: 10, bottom: 10 }}
                    spacing={0.2}
                    formatLabel={(_, index) => data[ index ].label}
                />
                <BarChart
                    style={{ flex: 1, marginLeft: 8 }}
                    data={data}
                    horizontal={true}
                    yAccessor={({ item }) => item.value}
                    svg={{ fill: 'rgba(134, 65, 244, 0.8)' }}
                    contentInset={{ top: 10, bottom: 10 }}
                    spacing={0.2}
                    gridMin={0}
                >
                    <Grid direction={Grid.Direction.VERTICAL}/>
                </BarChart>
            </View>

But, it had error: y.ticks is not a function(In ‘y.ticks(numberOfTicks)’, ‘y.ticks’ is undefined

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

4reactions
jbernhardt23commented, Oct 29, 2019

I’m having the same issue and it seems that the problem is in the way that YAxis is doing comparisons between the scale prop being passed to the component and the scale.scaleBrand used from the d3-scale dependency used in the library.

This particular ternary operation const ticks = scale === d3Scale.scaleBand ? values : y.ticks(numberOfTicks); is returning false if you passed a scale.scaleBran from another d3-scale version.

To fix this, use the same d3-scale version from the library which is 1.0.6.

1reaction
smubarak-alicommented, Sep 27, 2019

I am facing the same exact problem 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

this.map.tick is not a function - Stack Overflow
this.map.tick is not a function ; "#myBarChartOdometer"); var ; Chart(graphTarget12, { type: 'bar' ; $data = Odometer ; $name = array ; $i=0 ......
Read more >
Set or query y-axis tick values - MATLAB yticks - MathWorks
This MATLAB function sets the y-axis tick values, which are the locations along the y-axis where the tick marks appear.
Read more >
D3.js axis.ticks() Function - GeeksforGeeks
The d3.axis.ticks() Function in D3.js is used to control which ticks are displayed by the axis. This function returns the axis generator.
Read more >
scale.ticks / D3 - Observable
This method is often called indirectly by axis.ticks. scale.ticks returns an array ... The ticks depend on the scale's type and domain, but...
Read more >
D3 Axes - D3 in Depth
This article covers axis orientation, transitions, number of ticks, custom tick ... When a D3 scale function is used to define an axis,...
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