Comments (15)
Ok, I managed to reproduce that behavior.
When name of axis is displayed but without values that means that none of axis values are within viewport.
When neither name of axis nor axis values are displayed means that list of axis values is empty or null. Please, check if axisValuesForY is not empty. If you want axis to be auto-generated don't set values at all.
Btw. I'll try to improve AxesRenderer
implementation to display axis name even when there is no axis value.
from hellocharts-android.
Ok so i ve looked into both axis value and they are not empty. I play a bit with the viewport to se if i Can make it. But I m usine column chart and no matte what i do i Can t see axisX value on the botom of my activity. I m just tryin to display the Day (1,2,3) exactly like the screenshot you used for the presentation of your library. I see Day but then nothing no number. Maybe is there something specific to do with column or maybe, it's just the size of each column.
Don't know.
from hellocharts-android.
https://github.com/lecho/hellocharts-android/blob/master/screens/scr-column1.png
This one
from hellocharts-android.
...
from hellocharts-android.
One more thing that comes to my mind. In column chart you cannot set column X value, by default columns are automatically indexed from 0 to numberOfColumns-1. To display custom X label under first column you need AxisValue with value 0, under second column you need AxisValue with value 1 etc.
Maybe that is the problem. In my demo project I create custom X labels with months names in for-loop which looks like this:
List<AxisValue> axisValues = new ArrayList<AxisValue>();
for (int i = 0; i < numColumns; ++i) {
...
axisValues.add(new AxisValue(i, months[i].toCharArray()));
...
}
from hellocharts-android.
ok i manage to display all graph data, but now as you can see all the columns are displayed on the left and i want each column under 1,2,3,4,5,6,7,8 etc.. i can't figure out how i can set a specific day for wach column
i've made this
//List of columns
List<ColumnValue> listOfColumns = new ArrayList<ColumnValue>();
//values of the axeY
List<AxisValue> axisValuesForX = new ArrayList<AxisValue>();
//values of the axeY
List<AxisValue> axisValuesForY = new ArrayList<AxisValue>();
for (int i = 1,y = 0; i < nbrRow; i++, y+=5){
Jours jour = jourdb.getJoursWithID(i);
//if Total is different than 0, that's mean that the sum has been saved and the day is done.
if(jour.getTotal() != 0){
//add value to the x axis
axisValuesForX.add(new AxisValue(jour.getJours()));
//add value to the Y axis
axisValuesForY.add(new AxisValue(y));
//get the amount of pull ups
ColumnValue col_ = new ColumnValue(jour.getTotal(),green);
listOfColumns.add(col_);
}
}
//Gestion of the two axes for the graphic
Axis axeX = new Axis(axisValuesForX);
Axis axeY = new Axis(axisValuesForY);
and when i had this i have an unable to start activity error
axisValues.add(new AxisValue(i, months[i].toCharArray()));
from hellocharts-android.
Check samples project, in particular ColumnChartActivit.java.
There are columns and sub-columns. Every column can have one or more sub-columns. It looks like you want one sub-column for every column but instead you put all your values into single column. Try to create single ColumnValue for single Column, so one Columns will hold on ColumnValue which will hold single jour.total
value.
Another thing, AxisValue holds value of X index, columns have indexes from 0 to n-1 so AxisValues should hold values from 0 to n-1 and probably not jour.getJours()
. If you want custom axis label use AxisValue.setLabel(char[])
or AxisValue.setForrmater(ValueFormatter)
methods. Examples are available in samples project.
from hellocharts-android.
I've just renamed ColumnValue into SubcolumnValue, maybe this will be less confusing.
from hellocharts-android.
I've done this, but when i start it i get an error on graph.setColumnChartData(data)
int green = getResources().getColor(R.color.bg);
ColumnChartData data = new ColumnChartData();
dayFromDB jourdb = new dayFromDB(Statistiques.this);
jourdb.open();
DatabaseUtils dataUtils = new DatabaseUtils();
nbrRow = dataUtils.queryNumEntries(jourdb.getBDD(),TABLE);
ColumnChartView graph = (ColumnChartView) findViewById(R.id.chart);
List<SubcolumnValue> listOfColumns = new ArrayList<SubcolumnValue>();
List<AxisValue> axisValuesForX = new ArrayList<AxisValue>();
List<AxisValue> axisValuesForY = new ArrayList<AxisValue>();
for (int i = 1,y = 0; i < nbrRow; i++, y+=5) {
Jours jour = jourdb.getJoursWithID(i);
if(jour.getTotal() != 0){
axisValuesForY.add(new AxisValue(y));
SubcolumnValue col_ = new SubcolumnValue(jour.getTotal(),green);
listOfColumns.add(col_);
}
}
jourdb.close();
Axis axeX = new Axis();
Axis axeY = new Axis(axisValuesForY);
data.setAxisXBottom(axeX.setHasLines(true));
data.setAxisYLeft(axeY.setHasLines(true));
Column column = new Column();
column.setValues(listOfColumns);
column.setHasLabels(true);
List<Column> columns = new ArrayList<Column>();
columns.add(column);
data.setColumns(columns);
axeX.setName("Jours");
axeY.setName("Tractions");
graph.setColumnChartData(data);
from hellocharts-android.
Here is my xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<lecho.lib.hellocharts.view.ColumnChartView
android:id="@+id/chart"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
from hellocharts-android.
What error message you get?
from hellocharts-android.
I Will give you the exact error tonight. But I realy don't un der stand why! My code doesnt seems wrong
Envoyé depuis mon smartphone Samsung Galaxy.
-------- Message d'origine --------
De : Leszek Wach [email protected]
Date :29/01/2015 20:18 (GMT+01:00)
À : lecho/hellocharts-android [email protected]
Cc : thomaslc66 [email protected]
Objet : Re: [hellocharts-android] View Axis data (#16)
What error message you get?
—
Reply to this email directly or view it on GitHub.
from hellocharts-android.
Hi, Here is the error i've got
ligne 81 is the call to my method generateColum()
And line 192 is graph.setColumnChartData(data) into my generateColumn method
from hellocharts-android.
There is nothing related to library, you just have NPE in your code. Check if graph
is not null.
from hellocharts-android.
how to add data to ColumnChartView
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.