react-native-pathjs-charts icon indicating copy to clipboard operation
react-native-pathjs-charts copied to clipboard

Axis Title and Offset

Open danvass opened this issue 8 years ago • 7 comments

Is it possible to set an axis title and also to make the axis start a bit before and after the min and max values in a line chart? In addition, can you use strings for axis values on line charts and to place a dot at each of the data points?

I couldn't find any info in the wiki about this or the issues.

danvass avatar Feb 19 '17 03:02 danvass

"Possible to set an axis title?" - no, not right now but that is a very reasonable enhancement request.

"Make the axis start a bit before and after the min and max values in a line chart?" - I'm not sure I understand. Could you provide a screenshot example of what you see know and the data and options you are using for your chart and what you'd like to see instead? (Also is it a SmoothLine or StockLine?). The tailLength option may address what you want (although I suspect not) but I would need to understand your situation better.

"can you use strings for axis values?" - yes, supply a function in the labelFunction option - see the "StockLineChartDynamicTickLabels" example in the example app (regrettably, the wiki docs haven't kept up at this moment with changes like this option in the library)

"to place a dot at each of the data points?" - yes, use set the showTicks: option on axisX/axisY to true

marzolfb avatar Feb 19 '17 14:02 marzolfb

Thanks @marzolfb

  1. I see, that would be a nice feature to have.

  2. I'll check if tailLength fixes it but to try clarify. If I have a graph with two data points one at x=1 and x=2, I'd like the graph to show the axis from x=0 and x=4 so that the graph doesn't abruptly start and end. I can't send a screenshot as not at my laptop at the moment. It's also SmoothLine but not sure which of the two I'll use yet.

  3. Great, thanks.

  4. That just places dots along the axis, I meant dots along the line itself at each data point.

danvass avatar Feb 19 '17 14:02 danvass

On 2 - Ahh, I think you want to use the min and max options on the chart. However, these unfortunately only apply to the y-axis and not the x-axis (see my discussion with Cody-G-G on this topic - #80)

On 4 - Unfortunately, no, that ability isn't there. Thats's a duplicate of #40 which, like your Axis title suggestion, is also a very reasonable enhancement request

marzolfb avatar Feb 19 '17 15:02 marzolfb

Okay - great thanks. Those would be some nice additional features but apart from that it's a really great library. Thank you!

danvass avatar Feb 19 '17 15:02 danvass

@marzolfb Another enhancement features that would be useful would be to be able to set the axis 'steps'. For example, tell it so that each y axis line is 5 apart. So the axis Y shows 0 then 5 then 10 then 15 and so on.

danvass avatar Feb 24 '17 03:02 danvass

@DVassilev I believe that use case is supported via the tickValues option. See the StockLineChartStaticTickLabels chart in the example app for reference - you should be able to substitute numbers for values instead of the strings shown in the example.

marzolfb avatar Feb 24 '17 04:02 marzolfb

Is the tickValues supported for Bar Chart?

VanessaChu avatar Jan 02 '18 21:01 VanessaChu