Android Open Source - EazeGraph Stacked Bar Model






From Project

Back to project page EazeGraph.

License

The source code is released under:

Apache License

If you think the Android project EazeGraph listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/**
 *//  w  w w  . j  a  v a 2 s .  c om
 *   Copyright (C) 2014 Paul Cech
 *
 *   Licensed 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.
 */

package org.eazegraph.lib.models;

import android.graphics.RectF;

import java.util.ArrayList;
import java.util.List;

/**
 * Model for the {@link org.eazegraph.lib.charts.StackedBarChart}.
 * This is a simple Wrapper class for various {@link org.eazegraph.lib.models.BarModel}
 */
public class StackedBarModel extends BaseModel {

    public StackedBarModel() {
        super("Unset");
        mBars = new ArrayList<BarModel>();
    }

    public StackedBarModel(String _legendLabel) {
        super(_legendLabel);
        mBars = new ArrayList<BarModel>();
    }

    public StackedBarModel(List<BarModel> _bars) {
        super("Unset");
        mBars = _bars;
    }

    public StackedBarModel(String _legendLabel, List<BarModel> _bars) {
        super(_legendLabel);
        mBars = _bars;
    }

    public List<BarModel> getBars() {
        return mBars;
    }

    public void setBars(List<BarModel> _bars) {
        mBars = _bars;
    }

    public void addBar(BarModel _bar) {
        mBars.add(_bar);
    }

    public RectF getBounds() {
        RectF bounds = new RectF();
        if(!mBars.isEmpty()) {
            // get bounds from complete StackedBar
            bounds.set(
                    mBars.get(0).getBarBounds().left,
                    mBars.get(0).getBarBounds().top,
                    mBars.get(mBars.size() - 1).getBarBounds().right,
                    mBars.get(mBars.size() - 1).getBarBounds().bottom
            );
        }
        return bounds;
    }

    /**
     * Bars which are in the StackedBar.
     */
    List<BarModel> mBars;
}




Java Source Code List

org.eazegraph.lib.charts.BarChart.java
org.eazegraph.lib.charts.BaseBarChart.java
org.eazegraph.lib.charts.BaseChart.java
org.eazegraph.lib.charts.PieChart.java
org.eazegraph.lib.charts.StackedBarChart.java
org.eazegraph.lib.charts.ValueLineChart.java
org.eazegraph.lib.communication.IOnBarClickedListener.java
org.eazegraph.lib.communication.IOnItemFocusChangedListener.java
org.eazegraph.lib.communication.IOnPointFocusedListener.java
org.eazegraph.lib.models.BarModel.java
org.eazegraph.lib.models.BaseModel.java
org.eazegraph.lib.models.LegendModel.java
org.eazegraph.lib.models.PieModel.java
org.eazegraph.lib.models.Point2D.java
org.eazegraph.lib.models.StackedBarModel.java
org.eazegraph.lib.models.StandardValue.java
org.eazegraph.lib.models.ValueLinePoint.java
org.eazegraph.lib.models.ValueLineSeries.java
org.eazegraph.lib.utils.ScaleGestureDetectorCompat.java
org.eazegraph.lib.utils.Utils.java
org.eazegraph.showcase.ApplicationTest.java
org.eazegraph.showcase.ChartActivity.java
org.eazegraph.showcase.NavigationDrawerFragment.java
org.eazegraph.showcase.fragments.BarChartFragment.java
org.eazegraph.showcase.fragments.ChartFragment.java
org.eazegraph.showcase.fragments.CubicValueLineChartFragment.java
org.eazegraph.showcase.fragments.PieChartFragment.java
org.eazegraph.showcase.fragments.StackedBarChartFragment.java
org.eazegraph.showcase.fragments.ValueLineChartFragment.java