Coder Social home page Coder Social logo

Comments (4)

lecho avatar lecho commented on July 22, 2024

Hi, Im not sure if I understand what you mean by text labels.

For text labels instead of numeric values use method sliceValue.setLabel(char[]), dirty example:

SliceValue sliceValue = new SliceValue(44, Color.RED);
sliceValue.setLabel(("Students " + (int)sliceValue.getValue() + "%" ).toCharArray());
//or just
//sliceValue.setLabel(("Students 44%" ).toCharArray());

This will give you something like this:
text_labels

If by text labels you mean chart's legend - unfortunately it is not supported yet and for now you you will need to add some TextViews beside ChartView.

from hellocharts-android.

max929292 avatar max929292 commented on July 22, 2024

Thanks. This is awesome. Exactly what I wanted.

Now I also have a column chart. Is it also possible to make labels at the bottom of the columns?
This is what I have, but adding setLabel on column seems not to work:

values = new ArrayList();
values.add(new SubcolumnValue(273, Color.parseColor("#FF4444")));
column = new Column(values);
columns.add(column);

any ideas?

from hellocharts-android.

lecho avatar lecho commented on July 22, 2024

In case of column chart you need to set label on SubcolumnValue objects.

columns = new ArrayList<Column>();
for (int i = 0; i < numColumns; ++i) {
    subcolumns = new ArrayList<SubcolumnValue>();
    for (int j = 0; j < numSubcolumns; ++j) {
        SubcolumnValue subcolumn = new SubcolumnValue((float)Math.random(), Color.RED);
        subcolumn.setLabel("some_label".toCharArray());
        values.add(subcolumn);
    }

    Column column = new Column(subcolumns);
    column.setHasLabels(true);
    columns.add(column);
}

Labels are displayed above bar for positive values and below for negative, no option to display all labels at the bottom.

untitled

from hellocharts-android.

jcallejaa avatar jcallejaa commented on July 22, 2024

In case of column chart you need to set label on SubcolumnValue objects.

columns = new ArrayList<Column>();
for (int i = 0; i < numColumns; ++i) {
    subcolumns = new ArrayList<SubcolumnValue>();
    for (int j = 0; j < numSubcolumns; ++j) {
        SubcolumnValue subcolumn = new SubcolumnValue((float)Math.random(), Color.RED);
        subcolumn.setLabel("some_label".toCharArray());
        values.add(subcolumn);
    }

    Column column = new Column(subcolumns);
    column.setHasLabels(true);
    columns.add(column);
}

Labels are displayed above bar for positive values and below for negative, no option to display all labels at the bottom.

untitled

Is it possible to change labels background and/or labels text color?

from hellocharts-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.