react-native-pathjs-charts
react-native-pathjs-charts copied to clipboard
Axis Title and Offset
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.
"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
Thanks @marzolfb
-
I see, that would be a nice feature to have.
-
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.
-
Great, thanks.
-
That just places dots along the axis, I meant dots along the line itself at each data point.
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
Okay - great thanks. Those would be some nice additional features but apart from that it's a really great library. Thank you!
@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.
@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.
Is the tickValues supported for Bar Chart?