本文整理汇总了Java中com.jjoe64.graphview.series.LineGraphSeries类的典型用法代码示例。如果您正苦于以下问题:Java LineGraphSeries类的具体用法?Java LineGraphSeries怎么用?Java LineGraphSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineGraphSeries类属于com.jjoe64.graphview.series包,在下文中一共展示了LineGraphSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGraph
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
private void createGraph() {
_graphView.removeAllSeries();
SerializableList<MoneyMeterData> moneyMeterDataList = MoneyMeterListService.getInstance().GetActiveMoneyMeter().GetMoneyMeterDataList();
int moneyMeterDataListSize = moneyMeterDataList.getSize();
DataPoint[] dataPoints = new DataPoint[moneyMeterDataListSize];
Date firstDate = new Date();
Date lastDate = new Date();
for (int index = 0; index < moneyMeterDataListSize; index++) {
SerializableDate saveDate = moneyMeterDataList.getValue(index).GetSaveDate();
Date date = new Date(saveDate.Year(), saveDate.Month() - 1, saveDate.DayOfMonth());
dataPoints[index] = new DataPoint(date, moneyMeterDataList.getValue(index).GetAmount());
if (index == 0) {
firstDate = date;
} else if (index == moneyMeterDataListSize - 1) {
lastDate = date;
}
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints);
_graphView.addSeries(series);
_graphView.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(this));
_graphView.getGridLabelRenderer().setNumHorizontalLabels(3);
_graphView.getViewport().setMinX(firstDate.getTime());
_graphView.getViewport().setMaxX(lastDate.getTime());
_graphView.getViewport().setXAxisBoundsManual(true);
_graphView.getGridLabelRenderer().setHumanRounding(false);
}
示例2: getLineGraph
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
public LineGraphSeries<DataPoint> getLineGraph(TuneResult result) {
LineGraphSeries<DataPoint> series = new LineGraphSeries<>();
// There are 256 divisor, and the frequency is mapped as:
// freq_khz = 12000 / (n + 1)
// Divisor 95 is 125kHz, and 89 is 133.3 kHz (~134kHz)
//
// The official proxmark3 gui represents these as raw values, but we should represent it in
// frequency order instead.
//
// The number given is volts??
int[] graphData = result.getGraphData();
for (int x=255; x >= 0; x--) {
series.appendData(new DataPoint(-x, graphData[x]), true, 256);
}
return series;
}
示例3: onCreate
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_tune_result);
ActivityTuneResultBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_tune_result);
TuneResult tuneResult = getIntent().getParcelableExtra(TUNE_RESULT_KEY);
binding.setTuneResult(tuneResult);
GraphView gphTuning = (GraphView) findViewById(R.id.gphTuning);
LineGraphSeries<DataPoint> tuningSeries = getLineGraph(tuneResult);
gphTuning.addSeries(tuningSeries);
gphTuning.getViewport().setScalable(true);
gphTuning.getViewport().setScrollable(true);
// Translate the graph around on a pseudo-log scale
gphTuning.getGridLabelRenderer().setLabelFormatter(new FrequencyLabelFormatter());
}
示例4: draw
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
/**
* translates route data in a format that is easier to work with Graphview
* @return
*/
public LineGraphSeries draw() {
DataPoint[] datapoints = null;
if (this.route != null) {
datapoints = this.drawRoute();
} else if (this.routeHistory != null) {
datapoints = this.drawRouteHistory();
} else {
Log.e("TEST", "both drawable null");
//throw new RuntimeException();
}
Log.d("TEST datapoints length", String.valueOf(datapoints.length));
if (datapoints != null) {
LineGraphSeries<DataPoint> serie = new LineGraphSeries<>(datapoints);
serie.setDrawBackground(true);
serie.setBackgroundColor(R.color.sbb_red);
return serie;
} else {
return new LineGraphSeries<>();
}
}
示例5: configGraphic
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
private void configGraphic() {
series = new LineGraphSeries<>(graphicUtils.getDataPoints(getApplicationContext(), ExpenseDAO.getNoFilter()));
series.setTitle(getString(R.string.total));
series.setColor(Color.RED);
graph.addSeries(series);
graph.setTitle(getString(R.string.title_graphic));
graph.getViewport().setMinY(0);
graph.getViewport().setYAxisBoundsManual(true);
graph.getLegendRenderer().setVisible(true);
graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);
StaticLabelsFormatter labels = new GraphicUtils().getLabels(graph);
graph.getGridLabelRenderer().setLabelFormatter(labels);
}
示例6: addNowLine
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
public void addNowLine(GraphView graph, long now) {
LineGraphSeries<DataPoint> seriesNow;
DataPoint[] nowPoints = new DataPoint[]{
new DataPoint(now, 0),
new DataPoint(now, maxY)
};
seriesNow = new LineGraphSeries<>(nowPoints);
seriesNow.setDrawDataPoints(false);
// custom paint to make a dotted line
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(2);
paint.setPathEffect(new DashPathEffect(new float[]{10, 20}, 0));
paint.setColor(Color.WHITE);
seriesNow.setCustomPaint(paint);
addSeriesWithoutInvalidate(graph, seriesNow);
}
示例7: onViewCreated
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// init example series data
xSeries = new LineGraphSeries<>();
xSeries.setColor(color(R.color.red));
ySeries = new LineGraphSeries<>();
ySeries.setColor(color(R.color.green));
zSeries = new LineGraphSeries<>();
zSeries.setColor(color(R.color.blue));
graphView.getViewport().setXAxisBoundsManual(true);
graphView.getViewport().setMinX(0);
graphView.getViewport().setMaxX(maxDataPoints);
graphView.addSeries(xSeries);
graphView.addSeries(ySeries);
graphView.addSeries(zSeries);
}
示例8: 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++;
}
}
示例9: extractValuesSeries
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
private void extractValuesSeries() {
double[][] data = new double[spectrogram.length][2];
for(int i=0; i < spectrogram.length; i++){
data[i] = meanExtraction(spectrogram[i], CARRIER_IDX, currentHalfCarrierWidth);
}
DataPoint[] dps = new DataPoint[spectrogram.length];
DataPoint[] dps2 = new DataPoint[spectrogram.length];
for(int i=0; i< dps.length; i++){
dps[i] = new DataPoint(i, data[i][0]);
dps2[i] = new DataPoint(i, data[i][1]*-1);
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(dps);
LineGraphSeries<DataPoint> series2 = new LineGraphSeries<DataPoint>(dps2);
//TODO
//imageView.addSeries(series);
//imageView.addSeries(series2);
}
示例10: 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);
}
示例11: 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();
}
示例12: draw
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
public View draw(Collection<String> plottableKeys) {
Log.d(TAG, "Drawing graph. Plottable reference points: " + plotReference.size());
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View newLayout = inflater.inflate(R.layout.graph_layout, null);
GraphView graph = (GraphView) newLayout.findViewById(R.id.graph);
for (String key : plottableKeys) {
if (plottables.containsKey(key)) {
List<Double> plottable = plottables.get(key);
List<DataPoint> dataPoints = new ArrayList<>(plottable.size());
for (int i = 0; i < plottable.size(); i++) {
Double plotValue = plottable.get(i);
Double plotRef = plotReference.get(i);
if (plotValue != null && plotRef != null) {
dataPoints.add(new DataPoint(plotRef, plotValue));
}
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints.toArray(new
DataPoint[dataPoints.size()]));
series.setTitle(key);
graph.addSeries(series);
}
}
graph.getLegendRenderer().setVisible(true);
graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.BOTTOM);
return newLayout;
}
示例13: createGraph
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
private void createGraph() {
_graphView.removeAllSeries();
SerializableList<MeterData> meterDataList = MeterListService.getInstance().GetActiveMeter().GetMeterDataList();
int meterDataListSize = meterDataList.getSize();
DataPoint[] dataPoints = new DataPoint[meterDataListSize];
Date firstDate = new Date();
Date lastDate = new Date();
for (int index = 0; index < meterDataListSize; index++) {
SerializableDate saveDate = meterDataList.getValue(index).GetSaveDate();
SerializableTime saveTime = meterDataList.getValue(index).GetSaveTime();
Date date = new Date(saveDate.Year(), saveDate.Month() - 1, saveDate.DayOfMonth(), saveTime.Hour(), saveTime.Minute());
dataPoints[index] = new DataPoint(date, meterDataList.getValue(index).GetValue());
if (index == 0) {
firstDate = date;
} else if (index == meterDataListSize - 1) {
lastDate = date;
}
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints);
_graphView.addSeries(series);
_graphView.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(this));
_graphView.getGridLabelRenderer().setNumHorizontalLabels(3);
_graphView.getViewport().setMinX(firstDate.getTime());
_graphView.getViewport().setMaxX(lastDate.getTime());
_graphView.getViewport().setXAxisBoundsManual(true);
_graphView.getGridLabelRenderer().setHumanRounding(false);
}
示例14: onCreate
import com.jjoe64.graphview.series.LineGraphSeries; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_graph);
List<TimeStats> timeStatsList = PrefsController.instance.getPrefs().getTimeStatsList();
if (!timeStatsList.isEmpty()) {
// battery temperature graph
List<Float> batteryTemperatureList = Converters.TIME_STATS_TO_TEMPERATURE_LIST.apply(timeStatsList);
DataPoint[] batTempDataPoints = new DataPoint[batteryTemperatureList.size()];
int i = 0;
for (Float batteryTemperature : batteryTemperatureList) {
batTempDataPoints[i++] = new DataPoint(i, batteryTemperature);
}
GraphView tempGraph = (GraphView) findViewById(R.id.temperature_graph);
LineGraphSeries<DataPoint> batTempSeries = new LineGraphSeries<>(batTempDataPoints);
batTempSeries.setDrawDataPoints(true);
tempGraph.addSeries(batTempSeries);
// battery level graph
// List<Float> batteryLevelList = Converters.TIME_STATS_TO_BATTERY_LEVEL.apply(timeStatsList);
// DataPoint[] batLevelDataPoints = new DataPoint[batteryLevelList.size()];
// i = 0;
// for (Float batteryLevel: batteryLevelList) {
// batLevelDataPoints[i++] = new DataPoint(i, batteryLevel);
// }
// LineGraphSeries<DataPoint> batLevelSeries = new LineGraphSeries<>(batLevelDataPoints);
// GraphView lvlGraph = (GraphView) findViewById(R.id.level_graph);
// lvlGraph.addSeries(batLevelSeries);
}
}
示例15: 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);
}