Android Open Source - AndroidGraph Graph View Dimensions






From Project

Back to project page AndroidGraph.

License

The source code is released under:

MIT License

If you think the Android project AndroidGraph 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

package com.nimble.android_graph.Graph_Base;
/* w w  w.j  a va2s . c  om*/
import android.content.Context;
import android.util.AttributeSet;

/**
 * Created by Mike on 25/07/2014.
 */
public abstract class GraphViewDimensions extends GraphDataSettings {

    protected Range2d graphWidth;
    protected Range2d graphHeight;

    protected boolean dimenChange = false;

    GraphViewDimensions(Context context)
    {
        super(context);
        graphWidth = new Range2d();
        graphHeight = new Range2d();
    }

    public GraphViewDimensions(Context context, AttributeSet attr)
    {
        super(context, attr);
        graphWidth = new Range2d();
        graphHeight = new Range2d();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {

        graphWidth.update(margin.x, w - margin.x);
        graphHeight.update(margin.y, h - margin.y);

        if (useLabels) {
            //graphHeight.decreaseMax( (int) paint.getTextSize() + margin.y);
            //graphWidth.increaseMin( margin.x + (int) paint.measureText(axisLabels.y) );

            graphHeight.y -= (int) paint.getTextSize() + margin.y;
            graphWidth.x += margin.x + (int) paint.measureText(axisLabels.y);
        }

        gridSpacing.update( (float) ( graphHeight.length )/gridSize.x,
                (float) ( graphWidth.length )/gridSize.y );

        dimenChange = true;
        super.onSizeChanged(w, h, oldw, oldh);
    }
}




Java Source Code List

Nimble.com.androidgraph.ApplicationTest.java
com.nimble.android_graph.Activities.FragmentList.java
com.nimble.android_graph.Activities.GraphActivity.java
com.nimble.android_graph.Activities.GraphFragment.java
com.nimble.android_graph.Activities.GroupsFragment.java
com.nimble.android_graph.Graph.CurveGraph.java
com.nimble.android_graph.Graph.LineGraph.java
com.nimble.android_graph.Graph.Line.java
com.nimble.android_graph.Graph.ScatterGraph.java
com.nimble.android_graph.Graph.SineWave.java
com.nimble.android_graph.Graph_Base.Coord2d.java
com.nimble.android_graph.Graph_Base.GraphDataSettings.java
com.nimble.android_graph.Graph_Base.GraphDrawBackground.java
com.nimble.android_graph.Graph_Base.GraphRelateToScreen.java
com.nimble.android_graph.Graph_Base.GraphThreading.java
com.nimble.android_graph.Graph_Base.GraphTouchEvent.java
com.nimble.android_graph.Graph_Base.GraphViewDimensions.java
com.nimble.android_graph.Graph_Base.GraphView.java
com.nimble.android_graph.Graph_Base.Point.java
com.nimble.android_graph.Graph_Base.Range2d.java
com.nimble.android_graph.Graph.sine_scatter.java
com.nimble.android_graph.generics.Methods.java
com.nimble.android_graph.generics.ViewManipulators.java
com.nimble.android_graph.generics.testingSuite.java