本文整理汇总了Java中com.github.mikephil.charting.components.YAxis.AxisDependency方法的典型用法代码示例。如果您正苦于以下问题:Java YAxis.AxisDependency方法的具体用法?Java YAxis.AxisDependency怎么用?Java YAxis.AxisDependency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.components.YAxis
的用法示例。
在下文中一共展示了YAxis.AxisDependency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMinimumDistance
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the minimum distance from a touch value (in pixels) to the
* closest value (in pixels) that is displayed in the chart.
*
* @param closestValues
* @param pos
* @param axis
* @return
*/
protected float getMinimumDistance(List<Highlight> closestValues, float pos, YAxis.AxisDependency axis) {
float distance = Float.MAX_VALUE;
for (int i = 0; i < closestValues.size(); i++) {
Highlight high = closestValues.get(i);
if (high.getAxis() == axis) {
float tempDistance = Math.abs(getHighlightPos(high) - pos);
if (tempDistance < distance) {
distance = tempDistance;
}
}
}
return distance;
}
示例2: getClosestHighlightByPixel
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the Highlight of the DataSet that contains the closest value on the
* y-axis.
*
* @param closestValues contains two Highlight objects per DataSet closest to the selected x-position (determined by
* rounding up an down)
* @param x
* @param y
* @param axis the closest axis
* @param minSelectionDistance
* @return
*/
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
YAxis.AxisDependency axis, float minSelectionDistance) {
Highlight closest = null;
float distance = minSelectionDistance;
for (int i = 0; i < closestValues.size(); i++) {
Highlight high = closestValues.get(i);
if (axis == null || high.getAxis() == axis) {
float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());
if (cDistance < distance) {
closest = high;
distance = cDistance;
}
}
}
return closest;
}
示例3: setZoom
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@ReactProp(name = "zoom")
public void setZoom(BarLineChartBase chart, ReadableMap propMap) {
if (BridgeUtils.validate(propMap, ReadableType.Number, "scaleX") &&
BridgeUtils.validate(propMap, ReadableType.Number, "scaleY") &&
BridgeUtils.validate(propMap, ReadableType.Number, "xValue") &&
BridgeUtils.validate(propMap, ReadableType.Number, "yValue")) {
YAxis.AxisDependency axisDependency = YAxis.AxisDependency.LEFT;
if (propMap.hasKey("axisDependency") &&
propMap.getString("axisDependency").equalsIgnoreCase("RIGHT")) {
axisDependency = YAxis.AxisDependency.RIGHT;
}
chart.zoom(
(float) propMap.getDouble("scaleX"),
(float) propMap.getDouble("scaleY"),
(float) propMap.getDouble("xValue"),
(float) propMap.getDouble("yValue"),
axisDependency
);
}
}
示例4: getInstance
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public static ZoomJob getInstance(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue,
Transformer trans, YAxis.AxisDependency axis, View v) {
ZoomJob result = pool.get();
result.xValue = xValue;
result.yValue = yValue;
result.scaleX = scaleX;
result.scaleY = scaleY;
result.mViewPortHandler = viewPortHandler;
result.mTrans = trans;
result.axisDependency = axis;
result.view = v;
return result;
}
示例5: ZoomJob
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public ZoomJob(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans,
YAxis.AxisDependency axis, View v) {
super(viewPortHandler, xValue, yValue, trans, v);
this.scaleX = scaleX;
this.scaleY = scaleY;
this.axisDependency = axis;
}
示例6: Highlight
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* constructor
*
* @param x the x-value of the highlighted value
* @param y the y-value of the highlighted value
* @param dataSetIndex the index of the DataSet the highlighted value belongs to
*/
public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, YAxis.AxisDependency axis) {
this.mX = x;
this.mY = y;
this.mXPx = xPx;
this.mYPx = yPx;
this.mDataSetIndex = dataSetIndex;
this.axis = axis;
}
示例7: getPosition
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the position (in pixels) the provided Entry has inside the chart
* view or null, if the provided Entry is null.
*
* @param e
* @return
*/
public PointF getPosition(Entry e, YAxis.AxisDependency axis) {
if (e == null)
return null;
float[] vals = new float[]{
e.getXIndex(), e.getVal()
};
getTransformer(axis).pointValuesToPixel(vals);
return new PointF(vals[0], vals[1]);
}
示例8: getValuesByTouchPoint
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the x and y values in the chart at the given touch point
* (encapsulated in a PointD). This method transforms pixel coordinates to
* coordinates / values in the chart. This is the opposite method to
* getPixelsForValues(...).
*
* @param x
* @param y
* @return
*/
public PointD getValuesByTouchPoint(float x, float y, YAxis.AxisDependency axis) {
// create an array of the touch-point
float[] pts = new float[2];
pts[0] = x;
pts[1] = y;
getTransformer(axis).pixelsToValue(pts);
double xTouchVal = pts[0];
double yTouchVal = pts[1];
return new PointD(xTouchVal, yTouchVal);
}
示例9: ZoomJob
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public ZoomJob(ViewPortHandler viewPortHandler, float scaleX, float scaleY, float xValue, float yValue, Transformer trans, YAxis.AxisDependency axis, View v) {
super(viewPortHandler, xValue, yValue, trans, v);
this.scaleX = scaleX;
this.scaleY = scaleY;
this.axisDependency = axis;
}
示例10: getAxisDependency
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public YAxis.AxisDependency getAxisDependency() {
return mAxisDependency;
}
示例11: setAxisDependency
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public void setAxisDependency(YAxis.AxisDependency dependency) {
mAxisDependency = dependency;
}
示例12: getHighlightForX
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the corresponding Highlight for a given xVal and x- and y-touch position in pixels.
*
* @param xVal
* @param x
* @param y
* @return
*/
protected Highlight getHighlightForX(float xVal, float x, float y) {
List<Highlight> closestValues = getHighlightsAtXValue(xVal, x, y);
if(closestValues.isEmpty()) {
return null;
}
float leftAxisMinDist = getMinimumDistance(closestValues, y, YAxis.AxisDependency.LEFT);
float rightAxisMinDist = getMinimumDistance(closestValues, y, YAxis.AxisDependency.RIGHT);
YAxis.AxisDependency axis = leftAxisMinDist < rightAxisMinDist ? YAxis.AxisDependency.LEFT : YAxis.AxisDependency.RIGHT;
Highlight detail = getClosestHighlightByPixel(closestValues, x, y, axis, mChart.getMaxHighlightDistance());
return detail;
}
示例13: moveViewToY
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Centers the viewport to the specified y-value on the y-axis.
* This also refreshes the chart by calling invalidate().
*
* @param yValue
* @param axis - which axis should be used as a reference for the y-axis
*/
public void moveViewToY(float yValue, YAxis.AxisDependency axis) {
float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
Runnable job = new MoveViewJob(mViewPortHandler, 0f, yValue + valsInView / 2f,
getTransformer(axis), this);
addViewportJob(job);
}
示例14: getAxisDependency
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Returns the axis this DataSet should be plotted against.
*
* @return
*/
YAxis.AxisDependency getAxisDependency();
示例15: setAxisDependency
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Set the y-axis this DataSet should be plotted against (either LEFT or
* RIGHT). Default: LEFT
*
* @param dependency
*/
void setAxisDependency(YAxis.AxisDependency dependency);