本文整理了Java中com.github.mikephil.charting.components.YAxis.isEnabled()
方法的一些代码示例,展示了YAxis.isEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAxis.isEnabled()
方法的具体详情如下:
包路径:com.github.mikephil.charting.components.YAxis
类名称:YAxis
方法名:isEnabled
暂无
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Returns true if this axis needs horizontal offset, false if no offset is needed.
*
* @return
*/
public boolean needsOffset() {
if (isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
.OUTSIDE_CHART)
return true;
else
return false;
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void renderGridLines(Canvas c) {
if (!mYAxis.isEnabled())
return;
if (mYAxis.isDrawGridLinesEnabled()) {
int clipRestoreCount = c.save();
c.clipRect(getGridClippingRect());
float[] positions = getTransformedPositions();
mGridPaint.setColor(mYAxis.getGridColor());
mGridPaint.setStrokeWidth(mYAxis.getGridLineWidth());
mGridPaint.setPathEffect(mYAxis.getGridDashPathEffect());
Path gridLinePath = mRenderGridLinesPath;
gridLinePath.reset();
// draw the grid
for (int i = 0; i < positions.length; i += 2) {
// draw a path because lines don't support dashing on lower android versions
c.drawPath(linePath(gridLinePath, i, positions), mGridPaint);
gridLinePath.reset();
}
c.restoreToCount(clipRestoreCount);
}
if (mYAxis.isDrawZeroLineEnabled()) {
drawZeroLine(c);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void renderAxisLine(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
return;
mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());
if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
} else {
c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void renderAxisLine(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
return;
mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());
if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentTop(), mAxisLinePaint);
} else {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
public void renderAxisLabels(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())
return;
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void renderAxisLabels(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())
return;
mAxisLabelPaint.setTypeface(mYAxis.getTypeface());
mAxisLabelPaint.setTextSize(mYAxis.getTextSize());
mAxisLabelPaint.setColor(mYAxis.getTextColor());
MPPointF center = mChart.getCenterOffsets();
MPPointF pOut = MPPointF.getInstance(0,0);
float factor = mChart.getFactor();
final int from = mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
final int to = mYAxis.isDrawTopYLabelEntryEnabled()
? mYAxis.mEntryCount
: (mYAxis.mEntryCount - 1);
for (int j = from; j < to; j++) {
float r = (mYAxis.mEntries[j] - mYAxis.mAxisMinimum) * factor;
Utils.getPosition(center, r, mChart.getRotationAngle(), pOut);
String label = mYAxis.getFormattedLabel(j);
c.drawText(label, pOut.x + 10, pOut.y, mAxisLabelPaint);
}
MPPointF.recycleInstance(center);
MPPointF.recycleInstance(pOut);
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view.
*/
protected void autoScale() {
final float fromX = getLowestVisibleX();
final float toX = getHighestVisibleX();
mData.calcMinMaxY(fromX, toX);
mXAxis.calculate(mData.getXMin(), mData.getXMax());
// calculate axis range (min / max) according to provided data
if (mAxisLeft.isEnabled())
mAxisLeft.calculate(mData.getYMin(AxisDependency.LEFT),
mData.getYMax(AxisDependency.LEFT));
if (mAxisRight.isEnabled())
mAxisRight.calculate(mData.getYMin(AxisDependency.RIGHT),
mData.getYMax(AxisDependency.RIGHT));
calculateOffsets();
}
代码示例来源:origin: PhilJay/MPAndroidChart
public void renderAxisLabels(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())
return;
代码示例来源:origin: PhilJay/MPAndroidChart
if (mAxisLeft.isEnabled())
mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum, mAxisLeft.mAxisMaximum, mAxisLeft.isInverted());
if (mAxisRight.isEnabled())
mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum, mAxisRight.mAxisMaximum, mAxisRight.isInverted());
mXAxisRenderer.renderLimitLines(canvas);
if (mAxisLeft.isEnabled() && mAxisLeft.isDrawLimitLinesBehindDataEnabled())
mAxisRendererLeft.renderLimitLines(canvas);
if (mAxisRight.isEnabled() && mAxisRight.isDrawLimitLinesBehindDataEnabled())
mAxisRendererRight.renderLimitLines(canvas);
mXAxisRenderer.renderLimitLines(canvas);
if (mAxisLeft.isEnabled() && !mAxisLeft.isDrawLimitLinesBehindDataEnabled())
mAxisRendererLeft.renderLimitLines(canvas);
if (mAxisRight.isEnabled() && !mAxisRight.isDrawLimitLinesBehindDataEnabled())
mAxisRendererRight.renderLimitLines(canvas);
代码示例来源:origin: PhilJay/MPAndroidChart
mRenderer.drawExtras(canvas);
if (mYAxis.isEnabled() && mYAxis.isDrawLimitLinesBehindDataEnabled())
mYAxisRenderer.renderLimitLines(canvas);
mRenderer.drawHighlighted(canvas, mIndicesToHighlight);
if (mYAxis.isEnabled() && !mYAxis.isDrawLimitLinesBehindDataEnabled())
mYAxisRenderer.renderLimitLines(canvas);
代码示例来源:origin: PhilJay/MPAndroidChart
chart.getYAxis().setEnabled(!chart.getYAxis().isEnabled());
chart.invalidate();
break;
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* Returns true if this axis needs horizontal offset, false if no offset is needed.
*
* @return
*/
public boolean needsOffset() {
return isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
.OUTSIDE_CHART;
}
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
/**
* Returns true if this axis needs horizontal offset, false if no offset is needed.
*
* @return
*/
public boolean needsOffset() {
if (isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
.OUTSIDE_CHART)
return true;
else
return false;
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* Returns true if this axis needs horizontal offset, false if no offset is needed.
*
* @return
*/
public boolean needsOffset() {
if (isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
.OUTSIDE_CHART)
return true;
else
return false;
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
/**
* Returns true if this axis needs horizontal offset, false if no offset is needed.
*
* @return
*/
public boolean needsOffset() {
if (isEnabled() && isDrawLabelsEnabled() && getLabelPosition() == YAxisLabelPosition
.OUTSIDE_CHART)
return true;
else
return false;
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* 绘制Y轴刻度线
*/
public void renderScaleLines(Canvas c) {
if (!mYAxis.isDrawScale() || !mYAxis.isEnabled())
return;
float[] positions = getTransformedPositions();
//因为 正常情况下 图表坐标轴在 左下方,所以此处 倒序 由下至上 绘制刻度
for (int i = positions.length; i > 2; i -= 2) {
float offset = (positions[i - 1] - positions[i - 3]) / 5; //偏移量
drawScale(c, positions[i - 3], offset);
}
}
代码示例来源:origin: qqq3/good-weather
private void toggleYAxis() {
mTemperatureChart.getAxisLeft().setEnabled(!mTemperatureChart.getAxisLeft().isEnabled());
mWindChart.getAxisLeft().setEnabled(!mWindChart.getAxisLeft().isEnabled());
mRainChart.getAxisLeft().setEnabled(!mRainChart.getAxisLeft().isEnabled());
mSnowChart.getAxisLeft().setEnabled(!mSnowChart.getAxisLeft().isEnabled());
mTemperatureChart.invalidate();
mWindChart.invalidate();
mRainChart.invalidate();
mSnowChart.invalidate();
}
代码示例来源:origin: WenWangAndroid/ChartManager
public void closeY(View view) {
mRadarChart.getYAxis().setEnabled(!mRadarChart.getYAxis().isEnabled());
mRadarChart.invalidate();
}
代码示例来源:origin: thuryn/your-local-weather
private void toggleYAxis() {
mTemperatureChart.getAxisLeft().setEnabled(!mTemperatureChart.getAxisLeft().isEnabled());
mWindChart.getAxisLeft().setEnabled(!mWindChart.getAxisLeft().isEnabled());
mRainChart.getAxisLeft().setEnabled(!mRainChart.getAxisLeft().isEnabled());
mSnowChart.getAxisLeft().setEnabled(!mSnowChart.getAxisLeft().isEnabled());
mPressureChart.getAxisLeft().setEnabled(!mPressureChart.getAxisLeft().isEnabled());
mTemperatureChart.invalidate();
mWindChart.invalidate();
mRainChart.invalidate();
rainBarChart.invalidate();
mSnowChart.invalidate();
snowBarChart.invalidate();
mPressureChart.invalidate();
}
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
@Override
public void renderAxisLine(Canvas c) {
if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
return;
mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());
if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
} else {
c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
内容来源于网络,如有侵权,请联系作者删除!