本文整理汇总了Java中com.jjoe64.graphview.series.BarGraphSeries类的典型用法代码示例。如果您正苦于以下问题:Java BarGraphSeries类的具体用法?Java BarGraphSeries怎么用?Java BarGraphSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BarGraphSeries类属于com.jjoe64.graphview.series包,在下文中一共展示了BarGraphSeries类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSeries
import com.jjoe64.graphview.series.BarGraphSeries; //导入依赖的package包/类
private void createSeries(final GraphView view, final int spacing)
{
Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable()
{
public void run()
{
_series = new BarGraphSeries<>();
_series.setColor(Color.parseColor(options.color.get()));
_series.setDrawValuesOnTop(true);
_series.setValuesOnTopColor(Color.BLACK);
_series.setSpacing(spacing);
view.addSeries(_series);
}
}, 1);
}
开发者ID:hcmlab,项目名称:ssj,代码行数:18,代码来源:EventPainter.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("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
示例3: 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
示例4: 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
示例5: GraphViewXML
import com.jjoe64.graphview.series.BarGraphSeries; //导入依赖的package包/类
/**
* creates the graphview object with data and
* other options from xml attributes.
*
* @param context
* @param attrs
*/
public GraphViewXML(Context context, AttributeSet attrs) {
super(context, attrs);
// get attributes
TypedArray a=context.obtainStyledAttributes(
attrs,
R.styleable.GraphViewXML);
String dataStr = a.getString(R.styleable.GraphViewXML_seriesData);
int color = a.getColor(R.styleable.GraphViewXML_seriesColor, Color.TRANSPARENT);
String type = a.getString(R.styleable.GraphViewXML_seriesType);
String seriesTitle = a.getString(R.styleable.GraphViewXML_seriesTitle);
String title = a.getString(R.styleable.GraphViewXML_android_title);
a.recycle();
// decode data
DataPoint[] data;
if (dataStr == null || dataStr.isEmpty()) {
throw new IllegalArgumentException("Attribute seriesData is required in the format: 0=5.0;1=5;2=4;3=9");
} else {
String[] d = dataStr.split(";");
try {
data = new DataPoint[d.length];
int i = 0;
for (String dd : d) {
String[] xy = dd.split("=");
data[i] = new DataPoint(Double.parseDouble(xy[0]), Double.parseDouble(xy[1]));
i++;
}
} catch (Exception e) {
Log.e("GraphViewXML", e.toString());
throw new IllegalArgumentException("Attribute seriesData is broken. Use this format: 0=5.0;1=5;2=4;3=9");
}
}
// create series
BaseSeries<DataPoint> series;
if (type == null || type.isEmpty()) {
type = "line";
}
if (type.equals("line")) {
series = new LineGraphSeries<DataPoint>(data);
} else if (type.equals("bar")) {
series = new BarGraphSeries<DataPoint>(data);
} else if (type.equals("points")) {
series = new PointsGraphSeries<DataPoint>(data);
} else {
throw new IllegalArgumentException("unknown graph type: "+type+". Possible is line|bar|points");
}
if (color != Color.TRANSPARENT) {
series.setColor(color);
}
addSeries(series);
if (seriesTitle != null && !seriesTitle.isEmpty()) {
series.setTitle(seriesTitle);
getLegendRenderer().setVisible(true);
}
if (title != null && !title.isEmpty()) {
setTitle(title);
}
}
开发者ID:Popati,项目名称:Android-BluetoothSPPLibrary-master,代码行数:72,代码来源:GraphViewXML.java
注:本文中的com.jjoe64.graphview.series.BarGraphSeries类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论