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


Java Legend.LegendForm方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.components.Legend.LegendForm方法的典型用法代码示例。如果您正苦于以下问题:Java Legend.LegendForm方法的具体用法?Java Legend.LegendForm怎么用?Java Legend.LegendForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.components.Legend的用法示例。


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

示例1: setForm

import com.github.mikephil.charting.components.Legend; //导入方法依赖的package包/类
public void setForm(Legend.LegendForm form) {
    mForm = form;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:BaseDataSet.java

示例2: getForm

import com.github.mikephil.charting.components.Legend; //导入方法依赖的package包/类
@Override
public Legend.LegendForm getForm() {
    return mForm;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:BaseDataSet.java

示例3: drawForm

import com.github.mikephil.charting.components.Legend; //导入方法依赖的package包/类
/**
 * Draws the Legend-form at the given position with the color at the given
 * index.
 *
 * @param c      canvas to draw with
 * @param x      position
 * @param y      position
 * @param entry  the entry to render
 * @param legend the legend context
 */
protected void drawForm(
        Canvas c,
        float x, float y,
        LegendEntry entry,
        Legend legend) {

    if (entry.formColor == ColorTemplate.COLOR_SKIP ||
            entry.formColor == ColorTemplate.COLOR_NONE ||
            entry.formColor == 0)
        return;

    int restoreCount = c.save();

    Legend.LegendForm form = entry.form;
    if (form == Legend.LegendForm.DEFAULT)
        form = legend.getForm();

    mLegendFormPaint.setColor(entry.formColor);

    final float formSize = Utils.convertDpToPixel(
            Float.isNaN(entry.formSize)
                    ? legend.getFormSize()
                    : entry.formSize);
    final float half = formSize / 2f;

    switch (form) {
        case NONE:
            // Do nothing
            break;

        case EMPTY:
            // Do not draw, but keep space for the form
            break;

        case DEFAULT:
        case CIRCLE:
            mLegendFormPaint.setStyle(Paint.Style.FILL);
            c.drawCircle(x + half, y, half, mLegendFormPaint);
            break;

        case SQUARE:
            mLegendFormPaint.setStyle(Paint.Style.FILL);
            c.drawRect(x, y - half, x + formSize, y + half, mLegendFormPaint);
            break;

        case LINE:
        {
            final float formLineWidth = Utils.convertDpToPixel(
                    Float.isNaN(entry.formLineWidth)
                            ? legend.getFormLineWidth()
                            : entry.formLineWidth);
            final DashPathEffect formLineDashEffect = entry.formLineDashEffect == null
                    ? legend.getFormLineDashEffect()
                    : entry.formLineDashEffect;
            mLegendFormPaint.setStyle(Paint.Style.STROKE);
            mLegendFormPaint.setStrokeWidth(formLineWidth);
            mLegendFormPaint.setPathEffect(formLineDashEffect);

            mLineFormPath.reset();
            mLineFormPath.moveTo(x, y);
            mLineFormPath.lineTo(x + formSize, y);
            c.drawPath(mLineFormPath, mLegendFormPaint);
        }
            break;
    }

    c.restoreToCount(restoreCount);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:79,代码来源:LegendRenderer.java

示例4: getForm

import com.github.mikephil.charting.components.Legend; //导入方法依赖的package包/类
/**
 * The form to draw for this dataset in the legend.
 * <p/>
 * Return `DEFAULT` to use the default legend form.
 */
Legend.LegendForm getForm();
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:IDataSet.java


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