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


Java LineGraphSeries.setColor方法代码示例

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


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

示例1: initialize

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void initialize(LineGraphSeries<DataPoint>[] series){
    graph = (GraphView) myFragmentView.findViewById(R.id.graphView);
    float tmp;
    if(!sharedPref.getBoolean("pref_yAutoScale", true)){
        graph.getViewport().setYAxisBoundsManual(true);
        tmp = Float.parseFloat(sharedPref.getString("pref_y_min", "-200"));
        graph.getViewport().setMinY(tmp);
        tmp = Float.parseFloat(sharedPref.getString("pref_y_max", "200"));
        graph.getViewport().setMaxY(tmp);
    }
    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMinX(0);
    tmp = Integer.parseInt(sharedPref.getString("pref_windowSize", "200"));
    graph.getViewport().setMaxX(tmp);
    graph.getGridLabelRenderer().setHorizontalLabelsVisible(sharedPref.getBoolean("pref_xgridlabels", false));//pref_ygridlabels
    graph.getGridLabelRenderer().setVerticalLabelsVisible(sharedPref.getBoolean("pref_ygridlabels", true));
    int i =0;
    for (LineGraphSeries<DataPoint> sery : series) {
        if (sery != null) {
            sery.setColor(getColor(i));
            graph.addSeries(sery);
        }
        i++;
    }
}
 
开发者ID:sakulstra,项目名称:bluegraph,代码行数:26,代码来源:GraphFragment.java

示例2: addSeries

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void addSeries( ElevationResult[] elevationResults, int seriesIndex ) {
    DataPoint[] points;
    if (elevationResults == null){
        points = new DataPoint[1];
        points[0] = new DataPoint(0, 0);
    }
    else {
        points = new DataPoint[elevationResults.length];
        for (int i = 0; i < elevationResults.length; i++) {
            points[i] = new DataPoint(i, elevationResults[i].elevation);
        }
    }

    LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(points);
    series.setThickness(10);
    series.setColor(Color.BLACK);
    series.setTitle(String.format("%d", seriesIndex));

    allElevationResults.add(elevationResults);
    pathsSeries.add(series);
    graph.addSeries(series);
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:23,代码来源:PathElevationGraphDrawer.java

示例3: setSelectedSeriesAndColorIt

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void setSelectedSeriesAndColorIt(int index) {
    selectedSeriesIndex = index;
    // first remove all series
    graph.removeAllSeries();
    LineGraphSeries<DataPoint> currSeries;
    // now add all serieses but index
    for (int j = 0; j < pathsSeries.size(); j++) {
        if (j == index)
            continue;
        currSeries = pathsSeries.get(j);
        currSeries.setColor(Color.BLACK);
        graph.addSeries(currSeries);
        graph.invalidate();
    }
    if (pathsSeries.size() == 0){
        return;
    }
    currSeries = pathsSeries.get(index);
    currSeries.setColor(Color.rgb(48, 139, 159));
    graph.addSeries(currSeries);
    graph.invalidate();
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:23,代码来源:PathElevationGraphDrawer.java

示例4: onCreate

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

    GraphView graph = (GraphView) findViewById(R.id.graph);

    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(new DataPoint[] {
            new DataPoint(0, 4),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6),
            new DataPoint(5, 3),
            new DataPoint(6, 1)
    });
    series.setColor(Color.parseColor("#b485f2"));
    series.setDrawDataPoints(true);
    series.setDataPointsRadius(10);
    series.setThickness(5);

    graph.addSeries(series);
    graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setVerticalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setTextSize(30);

    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMaxX(6);

}
 
开发者ID:inceleb,项目名称:InstagramManager-Android,代码行数:31,代码来源:GraphActivity.java

示例5: onCreate

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

    GraphView graph = (GraphView) findViewById(R.id.graph);

    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(new DataPoint[] {
            new DataPoint(0, 4),
            new DataPoint(1, 5),
            new DataPoint(2, 3),
            new DataPoint(3, 2),
            new DataPoint(4, 6),
            new DataPoint(5, 3),
            new DataPoint(6, 1)
    });
    series.setColor(Color.parseColor("#b485f2"));
    series.setDrawDataPoints(true);
    series.setDataPointsRadius(10);
    series.setThickness(5);

    graph.addSeries(series);
    graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setVerticalLabelsColor(Color.parseColor("#777777"));
    graph.getGridLabelRenderer().setTextSize(30);
    
    graph.getViewport().setXAxisBoundsManual(true);
    graph.getViewport().setMaxX(6);

}
 
开发者ID:inceleb,项目名称:InstagramManager-Android,代码行数:31,代码来源:GraphActivity.java

示例6: addRatio

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void addRatio(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
    LineGraphSeries<DataPoint> ratioSeries;
    List<DataPoint> ratioArray = new ArrayList<>();
    Double maxRatioValueFound = 0d;
    Scale ratioScale = new Scale(-1d);

    for (long time = fromTime; time <= toTime; time += 5 * 60 * 1000L) {
        AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time);
        if (autosensData != null) {
            ratioArray.add(new DataPoint(time, autosensData.autosensRatio));
            maxRatioValueFound = Math.max(maxRatioValueFound, Math.abs(autosensData.autosensRatio));
        }
    }

    // RATIOS
    DataPoint[] ratioData = new DataPoint[ratioArray.size()];
    ratioData = ratioArray.toArray(ratioData);
    ratioSeries = new LineGraphSeries<>(ratioData);
    ratioSeries.setColor(MainApp.sResources.getColor(R.color.ratio));
    ratioSeries.setThickness(3);

    if (useForScale)
        maxY = maxRatioValueFound;

    ratioScale.setMultiplier(maxY * scale / maxRatioValueFound);

    addSeriesWithoutInvalidate(graph, ratioSeries);
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:29,代码来源:GraphData.java

示例7: onPageVisible

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void onPageVisible(final DataPoint[] datapoints, DataPoint[] averages) {
	if(datapoints != null && averages != null) {
		progressBar.setVisibility(View.GONE);
		graphView.removeAllSeries();
		DataPoint[] list = Arrays.copyOfRange(datapoints, Math.max(0, datapoints.length - period.getDays()), datapoints.length);
		LineGraphSeries<DataPoint> datapointsSerie = new LineGraphSeries<>(list);
		datapointsSerie.setDrawDataPoints(true);
		datapointsSerie.setColor(getContext().getResources().getColor(R.color.green));
		datapointsSerie.setTitle(getContext().getResources().getString(R.string.daily_average));
		datapointsSerie.setOnDataPointTapListener(this);
		graphView.addSeries(datapointsSerie);

		LineGraphSeries<DataPoint> averageSerie = new LineGraphSeries<>(Arrays.copyOfRange(averages, Math.max(0, averages.length - period.getDays()), averages.length));
		averageSerie.setColor(getContext().getResources().getColor(R.color.orange));
		averageSerie.setTitle(getContext().getResources().getString(R.string.trend));
		averageSerie.setDrawDataPoints(true);
		averageSerie.setDataPointsRadius(6f);
		averageSerie.setOnDataPointTapListener(this);
		graphView.addSeries(averageSerie);

		graphView.getViewport().setMinX(datapointsSerie.getLowestValueX());
		graphView.getViewport().setMaxX(datapointsSerie.getHighestValueX());
		graphView.getViewport().setXAxisBoundsManual(true);

		graphView.getGridLabelRenderer().setNumHorizontalLabels(period.getNbLabels());
		graphView.getGridLabelRenderer().setNumVerticalLabels(10);
		graphView.getLegendRenderer().setVisible(true);
		graphView.getLegendRenderer().setBackgroundColor(getContext().getResources().getColor(R.color.grand_exchange_legend));
		graphView.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);

		graphView.getGridLabelRenderer().setHumanRounding(false, true);

		graphView.setVisibility(View.VISIBLE);
	}
}
 
开发者ID:OSRSHelper,项目名称:OSRSHelper,代码行数:36,代码来源:GrandExchangePeriodFragment.java

示例8: createCompletionGraph

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
/**
 * Creates the completion metrics graph for the habit
 */
private void createCompletionGraph() {

    int startedWeeksAgo = DateUtil.WeekDifference(habit.getStartDate(), DateTime.now());
    if (startedWeeksAgo > 3) startedWeeksAgo = 3;

    Double runningTotal = 0.00;
    Double[] runningAverages = new Double[4];
    for (int i = -1 * startedWeeksAgo; i <= 0; i++) {
        runningTotal += completionMetrics.get(3+i);
        runningAverages[3+i] = runningTotal/(startedWeeksAgo + i + 1);
    }

    ArrayList<DataPoint> dataPoints = new ArrayList<>();
    for (int i = -1 * startedWeeksAgo; i <= 0; i++) {
        if(runningAverages[3+i] == null) runningAverages[3+i] = 0.00;
        dataPoints.add(new DataPoint(i, runningAverages[3+i]));
    }

    if(dataPoints.size() == 1) {
        dataPoints.add(new DataPoint(-1, 0.0));
        Collections.reverse(dataPoints);
    }

    //habit.setCompletionRate(runningAverages[3]);
    //habitRepository.update(habit.getKey(), habit);

    GraphView graph = (GraphView) findViewById(R.id.graph);
    graph.removeAllSeries();
    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints.toArray(new DataPoint[dataPoints.size()]));

    series.setTitle("Completion Metrics");
    series.setColor(Color.RED);

    graph.getViewport().setMinX(-3);
    graph.getViewport().setMaxX(0);
    graph.getViewport().setMinY(0);
    graph.getViewport().setMaxY(100);

    graph.getViewport().setYAxisBoundsManual(true);
    graph.getViewport().setXAxisBoundsManual(true);

    String[] xLabels = new String[4];
    ArrayList<Week> pastNWeeks = DateUtil.GetNPastWeeks(DateTime.now(), 4);
    for (int i = 0; i < 4; i++) {
        xLabels[i] = pastNWeeks.get(i).getStartOfWeek().toString("MMM d");
    }

    // use static labels for horizontal and vertical labels
    StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graph);
    staticLabelsFormatter.setVerticalLabels(new String[] {"0%","20%","40%","60%","80%","100%"});
    staticLabelsFormatter.setHorizontalLabels(xLabels);

    graph.setTitle("Events completed over last 4 weeks");
    int bgColor = (15 & 0xff) << 24 | (0xD3 & 0xff) << 16 | (0x2F & 0xff) << 8 | (0x2F & 0xff);
    graph.getViewport().setBackgroundColor(bgColor);

    graph.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter);
    graph.getGridLabelRenderer().setHighlightZeroLines(false);
    graph.getGridLabelRenderer().setNumHorizontalLabels(4);
    graph.getGridLabelRenderer().setNumVerticalLabels(6);

    graph.addSeries(series);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:67,代码来源:ViewHabitActivity.java

示例9: show

import com.jjoe64.graphview.series.LineGraphSeries; //导入方法依赖的package包/类
public void show(InsulinInterface insulin) {
    removeAllSeries();
    mSecondScale = null;
    double dia = insulin.getDia();
    int hours = (int) Math.floor(dia + 1);

    Treatment t = new Treatment();
    t.date = 0;
    t.insulin = 1d;

    LineGraphSeries<DataPoint> activitySeries = null;
    LineGraphSeries<DataPoint> iobSeries = null;
    List<DataPoint> activityArray = new ArrayList<>();
    List<DataPoint> iobArray = new ArrayList<>();

    for (long time = 0; time <= hours * 60 * 60 * 1000; time += 5 * 60 * 1000L) {
        Iob iob = t.iobCalc(time, dia);
        activityArray.add(new DataPoint(time / 60 / 1000, iob.activityContrib));
        iobArray.add(new DataPoint(time / 60 / 1000, iob.iobContrib));
    }

    DataPoint[] activityDataPoints = new DataPoint[activityArray.size()];
    activityDataPoints = activityArray.toArray(activityDataPoints);
    addSeries(activitySeries = new LineGraphSeries<>(activityDataPoints));
    activitySeries.setThickness(8);

    getViewport().setXAxisBoundsManual(true);
    getViewport().setMinX(0);
    getViewport().setMaxX(hours * 60);
    getGridLabelRenderer().setNumHorizontalLabels(hours + 1);
    getGridLabelRenderer().setHorizontalAxisTitle("[min]");
    getGridLabelRenderer().setVerticalLabelsColor(activitySeries.getColor());

    DataPoint[] iobDataPoints = new DataPoint[iobArray.size()];
    iobDataPoints = iobArray.toArray(iobDataPoints);
    getSecondScale().addSeries(iobSeries = new LineGraphSeries<>(iobDataPoints));
    iobSeries.setDrawBackground(true);
    iobSeries.setColor(Color.MAGENTA);
    iobSeries.setBackgroundColor(Color.argb(70, 255, 0, 255));
    getSecondScale().setMinY(0);
    getSecondScale().setMaxY(1);
    getGridLabelRenderer().setVerticalLabelsSecondScaleColor(Color.MAGENTA);
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:44,代码来源:ActivityGraph.java


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