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


Java BarGraphSeries.setTitle方法代码示例

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


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

示例1: onCreate

import com.jjoe64.graphview.series.BarGraphSeries; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_reporte);

        dbHelper = new DBHelper(this);

        Intent intent = getIntent();
        _id_reclutador =intent.getStringExtra("id_reclutador");
        fecha = intent.getStringExtra("fecha");
        fecha2 = intent.getStringExtra("fecha2");

        GraphView graph = (GraphView) findViewById(R.id.graph);
        BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(new DataPoint[] {
                new DataPoint(0, getEmpresaCount("BOSCH", fecha, fecha2)),
                new DataPoint(1, getEmpresaCount("HONEYWELL", fecha, fecha2)),
                new DataPoint(2, getEmpresaCount("UTC", fecha, fecha2)),
                new DataPoint(3, getEmpresaCount("SKYWORKS", fecha, fecha2)),

        });
        graph.addSeries(series);

// styling
        series.setValueDependentColor(new ValueDependentColor<DataPoint>() {
            @Override
            public int get(DataPoint data) {
                return Color.rgb((int) data.getX() * 255 / 4, (int) Math.abs(data.getY() * 255 / 6), 100);
            }
        });

        series.setSpacing(10);
        series.setTitle("Reporte de Fecha #1 a Fecha #2");

// draw values on top
        series.setDrawValuesOnTop(true);
        series.setValuesOnTopColor(Color.RED);
//series.setValuesOnTopSize(50);
        txtEmpresas = (TextView) findViewById(R.id.txtEmpresas);
        txtEmpresas.setText("1.- BOSCH\n2.- HONEYWELL\n3.- UTC\n4.- SKYWORKS");
    }
 
开发者ID:catcarlos,项目名称:gt-service,代码行数:41,代码来源:ActivityReporte.java

示例2: onCreate

import com.jjoe64.graphview.series.BarGraphSeries; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_reporte);

        dbHelper = new DBHelper(this);

        Intent intent = getIntent();
        _id_reclutador =intent.getStringExtra("id_reclutador");
        fecha = intent.getStringExtra("fecha");
        fecha2 = intent.getStringExtra("fecha2");

        GraphView graph = (GraphView) findViewById(R.id.graph);
        BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(new DataPoint[] {
                new DataPoint(0, getEmpresaCount("BOSCH", fecha, fecha2)),
                new DataPoint(1, getEmpresaCount("Chromalloy", fecha, fecha2)),
                new DataPoint(2, getEmpresaCount("UTC", fecha, fecha2))
        });
        graph.addSeries(series);

// styling
        series.setValueDependentColor(new ValueDependentColor<DataPoint>() {
            @Override
            public int get(DataPoint data) {
                return Color.rgb((int) data.getX() * 255 / 4, (int) Math.abs(data.getY() * 255 / 6), 100);
            }
        });

        series.setSpacing(10);
        series.setTitle("Reporte de Fecha #1 a Fecha #2");

// draw values on top
        series.setDrawValuesOnTop(true);
        series.setValuesOnTopColor(Color.RED);
//series.setValuesOnTopSize(50);
        txtEmpresas = (TextView) findViewById(R.id.txtEmpresas);
        txtEmpresas.setText("1.- BOSCH\n2.- Honeywell\n3.- UTC\n4.- Chromalloy\n5.- ManPower\n6.- Skyworks\n7.- Pilkington");
    }
 
开发者ID:catcarlos,项目名称:gt-service,代码行数:39,代码来源:ActivityReporteG.java

示例3: setupGraph

import com.jjoe64.graphview.series.BarGraphSeries; //导入方法依赖的package包/类
private void setupGraph(
        Map<String, List<StatsService.DataPoint>> dataPointsByCollectionId,
        GraphView graph,
        boolean yFromZero,
        final Formatter yAxisFormatter) {

    double minX = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(daysAgo) - TimeUnit.HOURS.toMillis(12);
    double maxX = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(12);
    double minY = 0;
    double maxY = 0;

    int colorNo = 0;
    for (String collectionId : dataPointsByCollectionId.keySet()) {
        List<StatsService.DataPoint> points = dataPointsByCollectionId.get(collectionId);

        BarGraphSeries series = new BarGraphSeries<>(points.toArray(new DataPointInterface[points.size()]));
        series.setColor(ContextCompat.getColor(this, graphColors[(colorNo ++) % graphColors.length]));
        series.setTitle(collectionId);

        graph.addSeries(series);

        if (minY == 0) {
            minY = series.getLowestValueY();
        }
        if (maxY == 0) {
            maxY = series.getHighestValueY();
        }

        maxY = Math.max(maxY, series.getHighestValueY());
        minY = Math.min(minY, series.getLowestValueY());
    }

    if (yFromZero) {
        minY = 0;
    }

    if (minY == maxY) {
        minY = 0;
        maxY = 1 + maxY * 1.5;
    }

    graph.getViewport().setMinX(minX);
    graph.getViewport().setMaxX(maxX);
    graph.getViewport().setXAxisBoundsManual(true);

    graph.getViewport().setMinY(minY);
    graph.getViewport().setMaxY(maxY);
    graph.getViewport().setYAxisBoundsManual(true);

    graph.getLegendRenderer().setFixedPosition(0, 0);
    graph.getLegendRenderer().setVisible(true);

    graph.getGridLabelRenderer().setLabelFormatter(new LabelFormatter() {
        public String lattestFormatted;
        Calendar cal = Calendar.getInstance();
        @Override
        public String formatLabel(double value, boolean isValueX) {
            if (isValueX) {
                cal.setTimeInMillis((long) value);
                String formatted = String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
                if (formatted.equals(lattestFormatted)) {
                    this.lattestFormatted = formatted;
                    return "";
                }
                this.lattestFormatted = formatted;
                return formatted;
            }
            return yAxisFormatter.format(value);
        }

        @Override
        public void setViewport(Viewport viewport) {}
    });
    graph.getGridLabelRenderer().setGridColor(Color.GRAY);
    graph.getGridLabelRenderer().setNumHorizontalLabels(daysAgo);
}
 
开发者ID:tkrajina,项目名称:10000sentences,代码行数:77,代码来源:StatsActivity.java


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