com.github.mikephil.charting.utils.Utils.convertDpToPixel()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.github.mikephil.charting.utils.Utils.convertDpToPixel()方法的一些代码示例,展示了Utils.convertDpToPixel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.convertDpToPixel()方法的具体详情如下:
包路径:com.github.mikephil.charting.utils.Utils
类名称:Utils
方法名:convertDpToPixel

Utils.convertDpToPixel介绍

[英]This method converts dp unit to equivalent pixels, depending on device density. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE.
[中]此方法根据设备密度将dp单位转换为等效像素。使用前需要初始化UTIL。

代码示例

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * sets the distance the highlighted piechart-slice of this DataSet is
 * "shifted" away from the center of the chart, default 12f
 *
 * @param shift
 */
public void setSelectionShift(float shift) {
  mShift = Utils.convertDpToPixel(shift);
}

代码示例来源:origin: PhilJay/MPAndroidChart

public Description() {
  super();
  // default size
  mTextSize = Utils.convertDpToPixel(8f);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the offset the center text should have from it's original position in dp. Default x = 0, y = 0
 *
 * @param x
 * @param y
 */
public void setCenterTextOffset(float x, float y) {
  mCenterTextOffset.x = Utils.convertDpToPixel(x);
  mCenterTextOffset.y = Utils.convertDpToPixel(y);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an extra offset to be appended to the viewport's bottom
 */
public void setExtraBottomOffset(float offset) {
  mExtraBottomOffset = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an offset in dp that allows the user to drag the chart over it's
 * bounds on the x-axis.
 *
 * @param offset
 */
public void setDragOffsetX(float offset) {
  mTransOffsetX = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the width of the highlight line in dp.
 * @param width
 */
public void setHighlightLineWidth(float width) {
  mHighlightLineWidth = Utils.convertDpToPixel(width);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted.
 * Default: 500dp
 *
 * @param distDp
 */
public void setMaxHighlightDistance(float distDp) {
  mMaxHighlightDistance = Utils.convertDpToPixel(distDp);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an extra offset to be appended to the viewport's top
 */
public void setExtraTopOffset(float offset) {
  mExtraTopOffset = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an extra offset to be appended to the viewport's right
 */
public void setExtraRightOffset(float offset) {
  mExtraRightOffset = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an extra offset to be appended to the viewport's left
 */
public void setExtraLeftOffset(float offset) {
  mExtraLeftOffset = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Set an offset in dp that allows the user to drag the chart over it's
 * bounds on the y-axis.
 *
 * @param offset
 */
public void setDragOffsetY(float offset) {
  mTransOffsetY = Utils.convertDpToPixel(offset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the width of the grid lines that are drawn away from each axis
 * label.
 *
 * @param width
 */
public void setGridLineWidth(float width) {
  mGridLineWidth = Utils.convertDpToPixel(width);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * default constructor
 */
public Legend() {
  this.mTextSize = Utils.convertDpToPixel(10f);
  this.mXOffset = Utils.convertDpToPixel(5f);
  this.mYOffset = Utils.convertDpToPixel(3f); // 2
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the width of the candle-shadow-line in pixels. Default 3f.
 *
 * @param width
 */
public void setShadowWidth(float width) {
  mShadowWidth = Utils.convertDpToPixel(width);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the minimum distance that will be interpreted as a "drag" by the chart in dp.
 * Default: 3dp
 *
 * @param dragTriggerDistance
 */
public void setDragTriggerDist(float dragTriggerDistance) {
  this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the width of the zero line in dp
 *
 * @param width
 */
public void setZeroLineWidth(float width) {
  this.mZeroLineWidth = Utils.convertDpToPixel(width);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the used y-axis offset for the labels on this axis. For the legend,
 * higher offset means the legend as a whole will be placed further away
 * from the top.
 *
 * @param yOffset
 */
public void setYOffset(float yOffset) {
  mYOffset = Utils.convertDpToPixel(yOffset);
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the width of the border lines in dp.
 *
 * @param width
 */
public void setBorderWidth(float width) {
  mBorderPaint.setStrokeWidth(Utils.convertDpToPixel(width));
}

代码示例来源:origin: PhilJay/MPAndroidChart

public BubbleChartRenderer(BubbleDataProvider chart, ChartAnimator animator,
              ViewPortHandler viewPortHandler) {
  super(animator, viewPortHandler);
  mChart = chart;
  mRenderPaint.setStyle(Style.FILL);
  mHighlightPaint.setStyle(Style.STROKE);
  mHighlightPaint.setStrokeWidth(Utils.convertDpToPixel(1.5f));
}

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the size of the center text of the PieChart in dp.
 *
 * @param sizeDp
 */
public void setCenterTextSize(float sizeDp) {
  ((PieChartRenderer) mRenderer).getPaintCenterText().setTextSize(
      Utils.convertDpToPixel(sizeDp));
}

相关文章