GithubHelp home page GithubHelp logo

fit-chart's Introduction

Fit Chart

Latest Version

Download

How to use

Configuring your project dependencies

Add the library dependency to your build.gradle file.

dependencies {
    ...
    compile 'com.txusballesteros:FitChart:1.0'
}

Adding the view to your layout

Add the view to your xml layout file.

<com.txusballesteros.widgets.FitChart
            android:layout_width="200dp"
            android:layout_height="200dp" />

Styling the view

If you want to customize the view, you can set the next attributes.

<com.txusballesteros.widgets.FitChart
            ..
            app:strokeSize="10dp"
            app:valueStrokeColor="#ff0000"
            app:backStrokeColor="#00ff00"
            app:animationMode="overdraw" />

Setting the values

Setting the minimum and maximum values of the scale of the chart.

final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
               fitChart.setMinValue(0f);
               fitChart.setMaxValue(100f);

Setting a single progress value.

final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
               fitChart.setValue(80f);

Setting a some progress values.

Collection<FitChartValue> values = new ArrayList<>();
values.add(new FitChartValue(30f, 0x2d4302));
values.add(new FitChartValue(20f, 0x75a80d));
values.add(new FitChartValue(15f, 0x8fc026));
values.add(new FitChartValue(10f, 0xB5CC84));
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
               fitChart.setValues(values);

License

Copyright Txus Ballesteros 2015 (@txusballesteros)

This file is part of some open source application.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contact: Txus Ballesteros [email protected]

fit-chart's People

Contributors

stephanebg avatar txusballesteros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fit-chart's Issues

setValues does not work as documented in ReadMe

As mentioned in issue #4 , it appears the hex code used in the readme file does not work.

Collection values = new ArrayList<>();
values.add(new FitChartValue(30f, 0x2d4302));
values.add(new FitChartValue(20f, 0x75a80d));
values.add(new FitChartValue(15f, 0x8fc026));
values.add(new FitChartValue(10f, 0xB5CC84));
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
fitChart.setValues(values);

The above code does not print anything in the fit-chart circle and leaves the circle empty.

After some poking around, I discovered that changing the hex code and referencing android.R.color instead of using the hex codes made the fit-chart work as expected. Here was the code that worked:

      final FitChart fitChart = (FitChart)findViewById(R.id.fitChart);
       fitChart.setMinValue(0f);
       fitChart.setMaxValue(100f);

       ArrayList<FitChartValue> values = new ArrayList<>();
       values.add(new FitChartValue(30f, getResources().getColor(android.R.color.black)));
       values.add(new FitChartValue(20f, getResources().getColor(android.R.color.holo_red_dark)));
       values.add(new FitChartValue(15f, getResources().getColor(android.R.color.holo_green_dark)));
       values.add(new FitChartValue(10f, getResources().getColor(android.R.color.holo_purple)));
       fitChart.setValues(values);

I'm not sure if this is a bug or simply a documentation error.

compileSdkVersion 28
minSdkVersion 23
targetSdkVersion 28

Change color of single progress

Hi,
thanks for the library. Is it possible to add a method to change the color of the progress when displaying only one?

Something like that:
fitChart.setValue(80f).setColor(0x2d4302);

Smooth Paint

Please, add two lines in method preparePaints:

this.backStrokePaint.setAntiAlias(true);
this.valueDesignPaint.setAntiAlias(true);

Gradle Code

hi, tnx for this project
please add the Grdle.Build for lastet Androd Studio

animationMode attribute conflicts with material-components-android attribute

In your attributes, you define an attribute called "animationMode", which conflicts with the attribute in the material-components-android library, preventing a successful build.

The attribute has been introduced to the material-components-android library in this commit:

https://github.com/material-components/material-components-android/blob/4dc914d737449180c6d89de5fe34c69bfe1850c4/lib/java/com/google/android/material/snackbar/res/values/attrs.xml

As you can see, it's a part of the 1.1.0-alpha01 release and it's not yet on the stable version.

Set initial value without animation

Hello!
Is there any way to set an initial value without showing the progress from zero? I'm updating the stats in real time, so showing the animation from zero everytime is a bit confusing.

Thanks!

setValues() doesn't work

I using the Library on Android Wear, I have been used it for one value, and it's working with me, but the problem is when i set collection of data(List), the chart doesn't show me anything.

Collection values = new ArrayList<>();
values.add(new FitChartValue(30f, 0x2d4302));
values.add(new FitChartValue(20f, 0x75a80d));
values.add(new FitChartValue(15f, 0x8fc026));
values.add(new FitChartValue(10f, 0xB5CC84));
FitChart mFitChart = (FitChart) findViewById(R.id.fitChart);
mFitChart.setValues(values);

How can i solve it ?!

Change Stroke Size programmatically in runtime?

Thanks for this library, really easy to use and convenient!
I was just wondering if there is a way to change the stroke size in runtime?

I use the fit chart to visualise exercise progress and would like to increase stroke size as user is getting closer to the goal...

Thanks in advance!

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.