本文整理汇总了Java中com.jjoe64.graphview.GraphView.setScalable方法的典型用法代码示例。如果您正苦于以下问题:Java GraphView.setScalable方法的具体用法?Java GraphView.setScalable怎么用?Java GraphView.setScalable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jjoe64.graphview.GraphView
的用法示例。
在下文中一共展示了GraphView.setScalable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGraph
import com.jjoe64.graphview.GraphView; //导入方法依赖的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);
}
}
示例2: datosGrafico
import com.jjoe64.graphview.GraphView; //导入方法依赖的package包/类
private void datosGrafico(String dorsal,String dato){
//Obtenemos los valores
SentenciasSQLiteDatosGrafico.getDatosGrafico(this,dorsal,dato);
SentenciasSQLiteDatosGrafico.getDiasGrafico(this);
int valores[]=SentenciasSQLiteDatosGrafico.getDatos();
int[] datos=valores;
String[] fechas=SentenciasSQLiteDatosGrafico.getDias();
TextView tituloDatos=(TextView) findViewById(R.id.graphic_data);
if(valores.length==0){
tituloDatos.setText(R.string.no_data);
}else{
tituloDatos.setText(R.string.yes_data);
}
GraphViewData[] datosY=new GraphViewData[datos.length];
for(int num=0;num<datos.length;num++){
datosY[num]=new GraphViewData(num,datos[num]);
}
GraphViewSeries series1=new GraphViewSeries(datosY);
GraphViewData[] datosX=new GraphViewData[datos.length];
for(int num=0;num<datos.length;num++){
datosX[num]=new GraphViewData(num,num);
}
GraphViewSeries series2=new GraphViewSeries(datosX);
GraphView graphView=new BarGraphView(this,"");
if(valores.length==0 & fechas.length==0){
graphView.getGraphViewStyle().setNumVerticalLabels(1);
graphView.getGraphViewStyle().setNumHorizontalLabels(1);
}else if(valores.length==0 & fechas.length!=0){
graphView.getGraphViewStyle().setNumVerticalLabels(1);
}else if(valores.length!=0 & fechas.length==0){
graphView.getGraphViewStyle().setNumHorizontalLabels(1);
}
graphView.setHorizontalLabels(fechas);
graphView.setViewPort(1,1);
graphView.setScalable(true);
graphView.addSeries(series2);
graphView.addSeries(series1);
LinearLayout layout=(LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);
}