Comments (10)
I like it but adjusting axis height will be a little tricky, right now height for horizontal axis is determined using font's ascent and descent values. For axis with rotated labels we will have to use Pythagorean triangle where hypotenuse is equal to the label's length.
from hellocharts-android.
Right.
If we think that the smaller sides are equal. Only with the value of the hypotenuse we can calculate the height.
In our case, the hypotenuse would be the label length.
Something like this:
labelLength ^ 2 = smallSide ^ 2 + smallSide ^ 2
labelLength ^ 2 = 2 * ( smallSide ^ 2 )
( labelLength ^ 2 ) / 2 = ( smallSide ^ 2 )
( ( labelLength ^ 2 ) / 2 ) ^ ( 1 / 2 ) = smallSide
newHeight = smallSide
newWidth = smallSide
What is the method you are using to calculate the length of the label?
from hellocharts-android.
Right now AxisRenderer calculates maximum label width based on Axis.maxLabelsChars
attribute, so it is the same for all labels in given axis because text measurement tends to be slow: AxisRenderer.java#L233
Label width is also used to determine how many labels should be visible for horizontal axis: AxesRenderer.java#L435
Maybe it will be good idea to introduce different attribute for that, for example labelSeparationCharsNumber
or something like that.
from hellocharts-android.
If we add the Pythagorean calculation in AxisRenderer.java#L233, would not be enough ?
For the rest of the code would work with the new width normally.
It would only be necessary to use the new height to position the axis name.
from hellocharts-android.
If we add the Pythagorean calculation in AxisRenderer.java#L233, would not be enough ?
Yea, I think that should be enough.
It would only be necessary to use the new height to position the axis name.
Yes, new height should be used for axis name baseline(if axis is not inside) and axis label height:
AxesRenderer.java#L296
AxesRenderer.java#L263
from hellocharts-android.
I did some testing and found that it is possible to implement
But I found a difficulty with full chart height 😕. Now the chart need to stretch vertically as the label height. (When the label be diagonally)
I think better to wait you look when you can.
from hellocharts-android.
Ok, I will have more time next week:)
from hellocharts-android.
I had some problems with this but now it should work. Axis has method `Axis.setHasLabelTilted(boolean)', if set to true labels for that axis are rotated by -45 degrees.
from hellocharts-android.
Very nice!
I will test tomorrow.
Thanks
from hellocharts-android.
can we start chart from right to left side? any idea about this? please help me if any one knows , thank you.
from hellocharts-android.
Related Issues (20)
- y axis value only shows three digits. i.e, 0,300,600,900,200,500,800,100 etc. I need to show it as 0,300,600,900,1200,1500,1800,2100 HOT 1
- groovy.lang.MissingPropertyException: Could not set unknown property 'name' for object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPom.
- How to change Background Color Label?
- setCurrentViewport different result on Run and ApplyChanges
- Hellocharts android library not rendering chart when there is a single value or when y axis values are same HOT 2
- "setHasGradientToTransparent" Are Missing on LineChart with Kotlin HOT 3
- How to set axis number to Text in column chart? HOT 1
- Cannot use line.setHasGradientToTransparent() method
- Is it possible to obtain values from the generated graph?
- Importing it as Module
- linechart with multicolor data line
- Compatibility with AndroidX HOT 1
- Horizontal spacing between points
- 关于一个点问题(已解决)
- About the problem that the y-axis is not displayed.
- Unsupported Modules Detected
- HelloCharts
- library configuration
- LineChartView can not make steps of 0.5f
- 垂直折线图
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hellocharts-android.