本文整理汇总了Java中com.jjoe64.graphview.GraphViewSeries类的典型用法代码示例。如果您正苦于以下问题:Java GraphViewSeries类的具体用法?Java GraphViewSeries怎么用?Java GraphViewSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphViewSeries类属于com.jjoe64.graphview包,在下文中一共展示了GraphViewSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSeries
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
public GraphViewSeries getSeries() {
if (this.series == null && this.points != null) {
GraphViewData data[] = new GraphViewData[days];
Calendar iter = GraphHelper.startDate(days);
for (int i = 0; i < days; ++i) {
String key = GraphHelper.DATE_FORMAT.format(iter.getTime());
GraphPoint point = null;
for (GraphPoint p : this.points) {
if (key.equals(p.getDate())) {
point = p;
break;
}
}
if (point != null) {
data[i] = new GraphViewData(i, point.getCount());
} else {
data[i] = new GraphViewData(i, 0);
}
iter.add(Calendar.DATE, 1);
}
this.series = new GraphViewSeries(label, style, data);
}
return this.series;
}
示例2: addSeries
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
/**
* Add a Serie (set of values) to be represented in the graph
* @param nameSerie Is the name given to the serie
* @param data Is an array with the values to be represented
*/
public boolean addSeries(String nameSerie, ArrayList<Float> data) {
if (hashSeries.get(nameSerie) == null) {
GraphViewData[] viewData = new GraphViewData[data.size()];
for (int i = 0; i < data.size(); i++) {
viewData[i] = new GraphViewData(i, data.get(i));
}
Integer c = data.size();
hashCont.put(nameSerie, c);
GraphViewSeries serie = new GraphViewSeries(viewData);
myGraphView.addSeries(serie);
hashSeries.put(nameSerie, serie);
return true;
} else
return false;
}
示例3: getSampleCode
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void getSampleCode() {
GraphViewSeries exampleSeries = new GraphViewSeries(new GraphView.GraphViewData[] {
new GraphView.GraphViewData(1, 2.0d)
, new GraphView.GraphViewData(2, 1.5d)
, new GraphView.GraphViewData(3, 2.5d)
, new GraphView.GraphViewData(4, 1.0d)
});
GraphView graphView = new LineGraphView(this, "GraphViewDemo");
graphView.addSeries(exampleSeries);
GraphView barGraphView = new BarGraphView(this, "BarGraphView");
barGraphView.addSeries(exampleSeries);
LinearLayout layout = (LinearLayout) findViewById(R.id.linear_layout);
layout.addView(barGraphView);
}
示例4: initGraph
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
@AfterViews
void initGraph() {
if (mScoreResponse != null) {
final TreeMap<Long, Double> scoreArray = mScoreResponse.getScoreArray();
final double width = scoreArray.lastKey() - scoreArray.firstKey();
final GraphView graphView = new LineGraphView(getActivity(), getString(R.string.chart_title));
GraphViewData[] data = new GraphViewData[scoreArray.size()];
int i = 0;
for (Map.Entry<Long, Double> entry : scoreArray.entrySet()) {
data[i] = new GraphViewData(entry.getKey(), entry.getValue());
i++;
}
final GraphViewSeriesStyle graphViewSeriesStyle = new GraphViewSeriesStyle(Color.WHITE, 4);
graphView.addSeries(new GraphViewSeries("Score", graphViewSeriesStyle, data));
graphView.setViewPort(0, width);
graphView.setScalable(true);
graphView.setScrollable(true);
graphContainer.addView(graphView);
}
}
示例5: redrawCharts
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void redrawCharts() {
if (data_line.size() > 0) {
GraphViewData[] dataList = new GraphViewData[data_line.size()];
for (int i = 0; i < data_line.size(); i++) {
dataList[i] = data_line.get(i);
}
GraphViewSeries gvs_light = new GraphViewSeries(dataList);
createGraph(firstGrpTitle, gvs_light, R.id.light_graph, isFirstBar);
} else {
clearChart(firstGrpTitle);
}
if (data_bar.size() > 0) {
GraphViewData[] dataAcc = new GraphViewData[data_bar.size()];
for (int i = 0; i < data_bar.size(); i++) {
dataAcc[i] = data_bar.get(i);
}
GraphViewSeries gvs_acc = new GraphViewSeries(dataAcc);
createGraph(secondGrpTitle, gvs_acc, R.id.motion_graph, isSecondBar);
} else {
clearChart(secondGrpTitle);
}
}
示例6: clearChart
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void clearChart(String title) {
GraphViewData[] dataList = new GraphViewData[1];
dataList[0] = new GraphViewData(0.0, 0.0);
GraphViewSeries gvs_series = new GraphViewSeries(dataList);
if (title.equals(firstGrpTitle)) {
createGraph(firstGrpTitle, gvs_series, R.id.light_graph, isFirstBar, 0);
data_line = new ArrayList<GraphView.GraphViewData>();
}
if (title.equals(secondGrpTitle)) {
createGraph(secondGrpTitle, gvs_series, R.id.motion_graph, isSecondBar, 0);
data_bar = new ArrayList<GraphView.GraphViewData>();
}
}
示例7: redrawCharts
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void redrawCharts() {
if (data_line.size() > 0) {
GraphViewData[] dataList = new GraphViewData[data_line.size()];
for (int i = 0; i < data_line.size(); i++) {
dataList[i] = data_line.get(i);
}
GraphViewSeries gvs_light = new GraphViewSeries(dataList);
createGraph(firstGrpTitle, gvs_light, R.id.light_graph, isFirstBar,
dataList.length);
} else {
clearChart(firstGrpTitle);
}
if (data_bar.size() > 0) {
GraphViewData[] dataAcc = new GraphViewData[data_bar.size()];
for (int i = 0; i < data_bar.size(); i++) {
dataAcc[i] = data_bar.get(i);
}
GraphViewSeries gvs_acc = new GraphViewSeries(dataAcc);
createGraph(secondGrpTitle, gvs_acc, R.id.motion_graph, isSecondBar,
dataAcc.length);
} else {
clearChart(secondGrpTitle);
}
}
示例8: onActivityCreated
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay()
.getMetrics(displaymetrics);
height = displaymetrics.heightPixels;
width = displaymetrics.widthPixels;
exampleSeries = new GraphViewSeries(
new GraphViewData[] { new GraphViewData(.0d, .0d) });
graphView = new LineGraphView(getActivity(), getString(R.string.empty));
graphView.addSeries(exampleSeries);
graphView.setLimit(limitDecibels);
graphView.setViewPort(0, 150);
graphView.setManualYAxisBounds(150, 0);
graphView.setScalable(true);
graphView.getGraphViewStyle().setHorizontalLabelsColor(
getResources().getColor(R.color.blue_bar));
graphView.getGraphViewStyle().setHorizontalLabelsColor(
getResources().getColor(android.R.color.transparent));
graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
graphLayout.addView(graphView);
isListen = false;
buttonClicked();
super.onActivityCreated(savedInstanceState);
}
示例9: Plot
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
/**
* Constructor. Initialize the variables.
* @param graph_type Is the type of graph to represent
* @param name Is the name given to the graph
*/
public Plot(GraphType graph_type, Context myContext, String name) {
super();
if (graph_type == GraphType.BAR)
this.myGraphView = new BarGraphView(myContext, name);
else
this.myGraphView = new LineGraphView(myContext, name);
hashSeries = new Hashtable<String, GraphViewSeries>();
hashCont = new Hashtable<String, Integer>();
numMax = 0;
}
示例10: removeSeries
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
/**
* Remove a serie from the graph.
* If the serie doesn't exist a null exception will be thrown.
* @param nameSerie Is the serie's name
*/
public void removeSeries(String nameSerie){
GraphViewSeries series = hashSeries.get(nameSerie);
myGraphView.removeSeries(series);
hashSeries.remove(nameSerie);
hashCont.remove(nameSerie);
}
示例11: GraphDataRetrieveTask
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
public GraphDataRetrieveTask(VehicleManager vehicleService, Activity act,
GraphViewSeries series, Class<? extends Measurement> measurementType) {
mVehicleManager = vehicleService;
mGraphSeries = series;
mMeasurementType = measurementType;
mActivity = act;
}
示例12: updateGraph
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
@SuppressWarnings("WeakerAccess")
void updateGraph() {
final GraphViewSeries temperatureSeries = new GraphViewSeries(
mGraphData.toArray(new GraphView.GraphViewData[mGraphData.size()]));
mGraph.removeAllSeries();
mGraph.addSeries(temperatureSeries);
}
示例13: drawGraph
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void drawGraph(final Journey journey) {
final LineGraphView graph = new LineGraphView(getActivity(), "");
List<GraphView.GraphViewData> data = new ArrayList<>();
for (Elevation elevation : journey.elevation().profile())
data.add(new GraphView.GraphViewData(elevation.distance(), elevation.elevation()));
GraphViewSeries graphSeries = new GraphViewSeries(data.toArray(new GraphView.GraphViewData[]{}));
graph.addSeries(graphSeries);
graph.setDrawBackground(true);
graph.getGraphViewStyle().setGridStyle(GraphViewStyle.GridStyle.HORIZONTAL);
graph.getGraphViewStyle().setNumHorizontalLabels(5);
graph.getGraphViewStyle().setNumVerticalLabels(4);
final ElevationFormatter formatter = ElevationFormatter.formatter(CycleStreetsPreferences.units());
graph.setCustomLabelFormatter(new CustomLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX) {
if (isValueX)
return (value != 0) ? formatter.distance((int)value) : "";
return formatter.height((int) value);
}
});
graphHolder_.removeAllViews();
graphHolder_.addView(graph);
}
示例14: GameStatus
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
public GameStatus(String title) {
mTitle = title;
mGraphViewSeries = new GraphViewSeries(new
GraphView.GraphViewData[] {
new GraphView.GraphViewData(mValueX++, 1.0f)
});
}
示例15: clearChart
import com.jjoe64.graphview.GraphViewSeries; //导入依赖的package包/类
private void clearChart(String title) {
GraphViewData[] dataList = new GraphViewData[1];
dataList[0] = new GraphViewData(0.0, 0.0);
GraphViewSeries gvs_series = new GraphViewSeries(dataList);
if (title.equals(firstGrpTitle)) {
createGraph(firstGrpTitle, gvs_series, R.id.light_graph, isFirstBar);
data_line = new ArrayList<GraphView.GraphViewData>();
}
if (title.equals(secondGrpTitle)) {
createGraph(secondGrpTitle, gvs_series, R.id.motion_graph, isSecondBar);
data_bar = new ArrayList<GraphView.GraphViewData>();
}
}