PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, April 23, 2022

[FIXED] How to add max/min values to a PieChart

 April 23, 2022     android, pie-chart     No comments   

Issue

I`m making a step counter and I would like to show the steps result alongside the goal. I used hellocharts-android by " lecho " from Github. Everything went smoothly but I would like to add a max and a min value for the chart.

How can this be done?

Activity.Xml:

    <lecho.lib.hellocharts.view.PieChartView
        android:id="@+id/barchart"
        android:layout_width="277dp"
        android:layout_height="250dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="20dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/t2" />

activity.java

  pieData.add(new SliceValue(15, getRandomColor()).setLabel(String.valueOf(counter)));
        PieChartData pieChartData = new PieChartData(pieData);
        pieChartData.setHasLabels(true);
        pieChartData.setHasCenterCircle(true).setCenterText1("Total Steps").setCenterText1FontSize(15).setCenterText1Color(Color.parseColor("#0097A7"));
        pieChartView.setPieChartData(pieChartData);

I want to have the piechart out of 1000 for example. Now it is percentage.


Solution

Just for the future reference, I have used DecoView "you can find it on GitHub".

        final SeriesItem seriesItem1 = new SeriesItem.Builder(Color.parseColor("#00b0ff"))
            .setRange(0, "Maximum Value", 0)
            .build();


Answered By - Manaf
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing