当前位置: 首页>>代码示例>>Java>>正文


Java XLayoutStyle类代码示例

本文整理汇总了Java中com.androidplot.ui.XLayoutStyle的典型用法代码示例。如果您正苦于以下问题:Java XLayoutStyle类的具体用法?Java XLayoutStyle怎么用?Java XLayoutStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XLayoutStyle类属于com.androidplot.ui包,在下文中一共展示了XLayoutStyle类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPreInit

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
@Override
protected void onPreInit() {
    pieWidget = new PieWidget(
            getLayoutManager(),
            this,
            new SizeMetrics(
                    PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_H_DP),
                    SizeLayoutType.FILL,
                    PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_W_DP),
                    SizeLayoutType.FILL));

    pieWidget.position(
            PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_X_OFFSET_DP),
            XLayoutStyle.ABSOLUTE_FROM_CENTER,
            PixelUtils.dpToPix(DEFAULT_PIE_WIDGET_Y_OFFSET_DP),
            YLayoutStyle.ABSOLUTE_FROM_CENTER,
            AnchorPosition.CENTER);

    pieWidget.setPadding(10, 10, 10, 10);

    // TODO: can't remember why this getClass() check is neccessary.  test if it actually is...
    /*if (getClass().equals(PieChart.class) && attrs != null) {
        loadAttrs(context, attrs);
    }*/
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:26,代码来源:PieChart.java

示例2: setupDomainWidget

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
private void setupDomainWidget() {
  // Set up the domain label text, color, size, position, boundaries and step
  plot.setDomainLabel(getString(R.string.label_domain));
  plot.getDomainLabelWidget().getLabelPaint().setColor(getResources().getColor(R.color.opensignals_text_field));
  plot.getDomainLabelWidget().getLabelPaint().setTextSize(40.0f);
  plot.getDomainLabelWidget().setWidth(1.0f, SizeLayoutType.RELATIVE);
  plot.getDomainLabelWidget().getPositionMetrics().getXPositionMetric().set(0, XLayoutStyle.RELATIVE_TO_LEFT);
  plot.getDomainLabelWidget().setClippingEnabled(false);
  plot.setDomainBoundaries(0, 5000, BoundaryMode.FIXED);
  plot.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL);
  plot.setDomainStepValue(10);
  plot.getGraphWidget().setDomainLabelPaint(null);
  plot.getGraphWidget().setDomainOriginLabelPaint(null);
}
 
开发者ID:pires,项目名称:opensignals-android,代码行数:15,代码来源:PortPageFragment.java

示例3: validatePair

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
/**
 * Throws IllegalArgumentException if there is a problem.
 * @param value
 */
protected void validatePair(float value, XLayoutStyle layoutStyle) {
    switch(layoutStyle) {
        case ABSOLUTE_FROM_LEFT:
        case ABSOLUTE_FROM_RIGHT:
        case ABSOLUTE_FROM_CENTER:
            validateValue(value, PositionMetric.LayoutMode.ABSOLUTE);
            break;
        case RELATIVE_TO_LEFT:
        case RELATIVE_TO_RIGHT:
        case RELATIVE_TO_CENTER:
            validateValue(value, PositionMetric.LayoutMode.RELATIVE);
    }
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:18,代码来源:XPositionMetric.java

示例4: initGraph

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
protected void initGraph(final boolean isEmpty) {
    int greyColor = getAppResouces().getColor(android.R.color.secondary_text_light_nodisable);
    xyPlot.getGraphWidget().getDomainGridLinePaint().setColor(greyColor);
    xyPlot.getGraphWidget().getRangeSubGridLinePaint().setColor(greyColor);
    xyPlot.getGraphWidget().getRangeGridLinePaint().setColor(greyColor);
    xyPlot.getGraphWidget().getDomainSubGridLinePaint().setColor(greyColor);
    xyPlot.getBackgroundPaint().setColor(Color.WHITE);
    xyPlot.setPlotMargins(0, 0, 0, 0);
    xyPlot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);
    xyPlot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE);
    xyPlot.getGraphWidget().getCursorLabelBackgroundPaint().setColor(greyColor);
    xyPlot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.WHITE);
    xyPlot.getGraphWidget().getRangeOriginLabelPaint().setColor(greyColor);
    xyPlot.getGraphWidget().getDomainOriginLinePaint().setColor(greyColor);
    xyPlot.getGraphWidget().getRangeOriginLinePaint().setColor(greyColor);
    xyPlot.getGraphWidget().getDomainLabelPaint().setColor(greyColor);
    xyPlot.getGraphWidget().getRangeLabelPaint().setColor(greyColor);
    xyPlot.getDomainLabelWidget().getLabelPaint().setColor(greyColor);
    xyPlot.getRangeLabelWidget().getLabelPaint().setColor(greyColor);
    xyPlot.getDomainLabelWidget().position(0, XLayoutStyle.ABSOLUTE_FROM_CENTER,
            0, YLayoutStyle.RELATIVE_TO_BOTTOM, AnchorPosition.BOTTOM_MIDDLE);
    xyPlot.getTitleWidget().getLabelPaint().setColor(Color.TRANSPARENT);
    xyPlot.getTitleWidget().setVisible(false);
    xyPlot.getLegendWidget().setVisible(false);

    float domainLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelWidth);
    float rangeLabelWidth = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelWidth);
    float rangeLabelVerticalOffset = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelVerticalOffset);

    float domainLabelMarginLeft = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginLeft);
    float domainLabelMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.domainLabelMarginRight);
    float rangeLabelMargin = getAppResouces().getDimensionPixelSize(R.dimen.rangeLabelMargin);
    float gridPaddingMargin = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMargin);
    float gridPaddingMarginRight = getAppResouces().getDimensionPixelSize(R.dimen.gridPaddingMarginRight);

    xyPlot.getDomainLabelWidget().setMargins(domainLabelMarginLeft, 0, domainLabelMarginRight, 0);
    xyPlot.getRangeLabelWidget().setMargins(rangeLabelMargin, 0, rangeLabelMargin, 0);
    xyPlot.getGraphWidget().setGridPadding(gridPaddingMargin, gridPaddingMargin, gridPaddingMarginRight, gridPaddingMargin);
    xyPlot.getGraphWidget().setDomainLabelWidth(domainLabelWidth);
    xyPlot.getGraphWidget().setRangeLabelWidth(rangeLabelWidth);
    xyPlot.getGraphWidget().setDomainLabelHorizontalOffset(0);
    xyPlot.getGraphWidget().setRangeLabelVerticalOffset(rangeLabelVerticalOffset);

    xyPlot.getDomainLabelWidget().pack();
    xyPlot.getRangeLabelWidget().pack();
    final String secStr = getContext().getString(R.string.seconds);
    final DecimalFormat domainFmt = new DecimalFormat("#.#");
    xyPlot.setDomainValueFormat(new NumberFormat() {
        @Override
        public StringBuffer format(double d, StringBuffer sb, FieldPosition fp) {
            return sb.append(domainFmt.format(d / 50f)).append(secStr);
        }
        @Override
        public StringBuffer format(long l, StringBuffer stringBuffer, FieldPosition fieldPosition) {
            return null;
        }
        @Override
        public Number parse(String s, ParsePosition parsePosition) {
            return null;
        }
    });
    xyPlot.setRangeValueFormat(new DecimalFormat("#.#G"));
    xyPlot.setDomainBoundaries(0, 100, BoundaryMode.FIXED);
    xyPlot.setDomainStepValue(2);
    xyPlot.setRangeStepValue(11);
    xyPlot.setRangeBoundaries(-0.5f, 0.5f, BoundaryMode.FIXED);
    DashPathEffect dashFx = new DashPathEffect(new float[] {PixelUtils.dpToPix(3), PixelUtils.dpToPix(3)}, 0);
    xyPlot.getGraphWidget().getDomainGridLinePaint().setPathEffect(dashFx);
    xyPlot.getGraphWidget().getRangeGridLinePaint().setPathEffect(dashFx);
    setGraphData(null);
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:72,代码来源:StartMeasurementFragment.java

示例5: init

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
    PixelUtils.init(getContext());
    layoutManager = new LayoutManager();
    titleWidget = new TextLabelWidget(layoutManager, new SizeMetrics(25,
            SizeLayoutType.ABSOLUTE, 100,
            SizeLayoutType.ABSOLUTE),
            TextOrientationType.HORIZONTAL);
    titleWidget.position(0, XLayoutStyle.RELATIVE_TO_CENTER, 0,
            YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.TOP_MIDDLE);

    // initialize attr defaults:
    titleWidget.getLabelPaint().setTextSize(
            PixelUtils.spToPix(DEFAULT_TITLE_WIDGET_TEXT_SIZE_SP));

    onPreInit();
    // make sure the title widget is always the topmost widget:
    layoutManager.moveToTop(titleWidget);
    if(context != null && attrs != null) {
        loadAttrs(attrs, defStyle);
    }

    layoutManager.onPostInit();
    //Log.d(TAG, "AndroidPlot RenderMode: " + renderMode);
    if (renderMode == RenderMode.USE_BACKGROUND_THREAD) {
        renderThread = new Thread(new Runnable() {
            @Override
            public void run() {

                keepRunning = true;
                while (keepRunning) {
                    isIdle = false;
                    synchronized (pingPong) {
                        Canvas c = pingPong.getCanvas();
                        renderOnCanvas(c);
                        pingPong.swap();
                    }
                    synchronized (renderSynch) {
                        postInvalidate();
                        // prevent this thread from becoming an orphan
                        // after the view is destroyed
                        if (keepRunning) {
                            try {
                                renderSynch.wait();
                            } catch (InterruptedException e) {
                                keepRunning = false;
                            }
                        }
                    }
                }
                System.out.println("AndroidPlot render thread finished.");
            }
        });
    }
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:55,代码来源:Plot.java

示例6: XPositionMetric

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
public XPositionMetric(float value, XLayoutStyle layoutStyle) {
    super(value, layoutStyle);
    validatePair(value, layoutStyle);
    //this.layoutStyle = layoutStyle;
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:6,代码来源:XPositionMetric.java

示例7: setLayoutType

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
@Override
public void setLayoutType(XLayoutStyle layoutType) {
    super.setLayoutType(layoutType);
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:5,代码来源:XPositionMetric.java

示例8: position

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
/**
 * Same as {@link #position(float, com.androidplot.ui.XLayoutStyle, float, com.androidplot.ui.YLayoutStyle, com.androidplot.ui.AnchorPosition)}
 * but with the anchor parameter defaulted to the upper left corner.
 * @param x
 * @param xLayoutStyle
 * @param y
 * @param yLayoutStyle
 */
public void position(float x, XLayoutStyle xLayoutStyle, float y, YLayoutStyle yLayoutStyle) {
    position(x, xLayoutStyle, y, yLayoutStyle, AnchorPosition.LEFT_TOP);
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:12,代码来源:Widget.java

示例9: YValueMarker

import com.androidplot.ui.XLayoutStyle; //导入依赖的package包/类
/**
 *
 * @param value
 * @param text Set to null to use the plot's default formatter.
 */
public YValueMarker(Number value, String text) {
    super(value, text, new XPositionMetric(3, XLayoutStyle.ABSOLUTE_FROM_LEFT));
}
 
开发者ID:LoriLori,项目名称:androidCgmMonitor,代码行数:9,代码来源:YValueMarker.java


注:本文中的com.androidplot.ui.XLayoutStyle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。