本文整理汇总了Java中com.db.chart.model.LineSet类的典型用法代码示例。如果您正苦于以下问题:Java LineSet类的具体用法?Java LineSet怎么用?Java LineSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineSet类属于com.db.chart.model包,在下文中一共展示了LineSet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: populateChart
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void populateChart(String[] labels, float[] values, LineChartView graphView) {
LineSet dataSet = new LineSet(labels, values);
int maxValue = detailBreakDownPresenter.getMaxHeight(values);
dataSet.setColor(ContextCompat.getColor(context, R.color.colorGrey))
.setFill(ContextCompat.getColor(context, android.R.color.transparent))
.setDotsColor(ContextCompat.getColor(context, R.color.colorGrey))
.setThickness(4)
.setDashed(new float[] { 10f, 10f })
.beginAt(0);
// Chart
graphView.setBorderSpacing(Tools.fromDpToPx(15))
.setYLabels(AxisRenderer.LabelPosition.NONE)
.setLabelsColor(ContextCompat.getColor(context, R.color.colorGrey))
.setXAxis(false)
.setAxisBorderValues(0, maxValue, 2)
.setYAxis(false);
graphView.reset();
graphView.addData(dataSet);
graphView.animate();
graphView.show();
}
开发者ID:riteshakya037,项目名称:Subs,代码行数:22,代码来源:DetailBreakDownFragment.java
示例2: refreshLineChart
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void refreshLineChart() {
lineChartView.reset();
float min = Float.MAX_VALUE, max = Float.MIN_VALUE;
for (int i = 0; i < arr.length; i++) {
min = min < arr[i] ? min : arr[i];
max = max > arr[i] ? max : arr[i];
}
float values[] = new float[7];
for (int i = 0; i < 7; i++) {
values[i] = arr[i];
}
LineSet lineset = new LineSet(labels, values);
lineset.setFill(Color.rgb(145, 205, 100));
lineset.setDotsStrokeColor(Color.RED);
lineset.setColor(Color.GRAY);
lineChartView.addData(lineset);
int mmax = (int) max + 10;
int mmin = (int) (min - 10 < 0 ? 0 : min - 10);
mmax += 10 - (mmax - mmin) % 10;
lineChartView.setAxisBorderValues(mmin, mmax, 10);
buildChart(lineChartView, (mmax - mmin) / 5, 6);
lineChartView.show(buildAnimation());
}
开发者ID:arunrajora,项目名称:Chit-Chat,代码行数:24,代码来源:BotDetailsActivity.java
示例3: temperatureGraph
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void temperatureGraph() {
LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_temperature);
// Data
LineSet dataset = new LineSet();
for (int i = 0; i < weatherList.size(); i++) {
float temperature = UnitConvertor.convertTemperature(Float.parseFloat(weatherList.get(i).getTemperature()), sp);
if (temperature < minTemp) {
minTemp = temperature;
}
if (temperature > maxTemp) {
maxTemp = temperature;
}
dataset.addPoint(getDateLabel(weatherList.get(i), i), (float) ((Math.ceil(temperature / 2)) * 2));
}
dataset.setSmooth(false);
dataset.setColor(Color.parseColor("#FF5722"));
dataset.setThickness(4);
lineChartView.addData(dataset);
// Grid
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(Color.parseColor("#333333"));
paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
paint.setStrokeWidth(1);
lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
lineChartView.setAxisBorderValues((int) minTemp - 2, (int) maxTemp + 2);
lineChartView.setStep(2);
lineChartView.setXAxis(false);
lineChartView.setYAxis(false);
lineChartView.show();
}
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java
示例4: rainGraph
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void rainGraph() {
LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_rain);
// Data
LineSet dataset = new LineSet();
for (int i = 0; i < weatherList.size(); i++) {
float rain = Float.parseFloat(weatherList.get(i).getRain());
if (rain < minRain) {
minRain = rain;
}
if (rain > maxRain) {
maxRain = rain;
}
dataset.addPoint(getDateLabel(weatherList.get(i), i), rain);
}
dataset.setSmooth(false);
dataset.setColor(Color.parseColor("#2196F3"));
dataset.setThickness(4);
lineChartView.addData(dataset);
// Grid
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(Color.parseColor("#333333"));
paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
paint.setStrokeWidth(1);
lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
lineChartView.setAxisBorderValues((int) minRain - 1, (int) maxRain + 2);
lineChartView.setStep(1);
lineChartView.setXAxis(false);
lineChartView.setYAxis(false);
lineChartView.show();
}
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java
示例5: pressureGraph
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void pressureGraph() {
LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_pressure);
// Data
LineSet dataset = new LineSet();
for (int i = 0; i < weatherList.size(); i++) {
float pressure = UnitConvertor.convertPressure(Float.parseFloat(weatherList.get(i).getPressure()), sp);
if (pressure < minPressure) {
minPressure = pressure;
}
if (pressure > maxPressure) {
maxPressure = pressure;
}
dataset.addPoint(getDateLabel(weatherList.get(i), i), pressure);
}
dataset.setSmooth(true);
dataset.setColor(Color.parseColor("#4CAF50"));
dataset.setThickness(4);
lineChartView.addData(dataset);
// Grid
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(Color.parseColor("#333333"));
paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
paint.setStrokeWidth(1);
lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
lineChartView.setAxisBorderValues((int) minPressure - 1, (int) maxPressure + 1);
lineChartView.setStep(2);
lineChartView.setXAxis(false);
lineChartView.setYAxis(false);
lineChartView.show();
}
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:41,代码来源:GraphActivity.java
示例6: renderChart
import com.db.chart.model.LineSet; //导入依赖的package包/类
public void renderChart(Cursor data) {
LineSet lineSet = new LineSet();
float minimumPrice = Float.MAX_VALUE;
float maximumPrice = Float.MIN_VALUE;
for (data.moveToFirst(); !data.isAfterLast(); data.moveToNext()) {
String label = data.getString(data.getColumnIndexOrThrow(QuoteColumns.BIDPRICE));
float price = Float.parseFloat(label);
lineSet.addPoint(label, price);
minimumPrice = Math.min(minimumPrice, price);
maximumPrice = Math.max(maximumPrice, price);
}
lineSet.setColor(Color.parseColor("#758cbb"))
.setFill(Color.parseColor("#2d374c"))
.setDotsColor(Color.parseColor("#758cbb"))
.setThickness(4)
.setDashed(new float[]{10f, 10f});
lineChartView.setBorderSpacing(Tools.fromDpToPx(15))
.setYLabels(AxisController.LabelPosition.OUTSIDE)
.setXLabels(AxisController.LabelPosition.NONE)
.setLabelsColor(Color.parseColor("#6a84c3"))
.setXAxis(false)
.setYAxis(false)
.setAxisBorderValues(Math.round(Math.max(0f, minimumPrice - 5f)), Math.round(maximumPrice + 5f))
.addData(lineSet);
Animation anim = new Animation();
if (lineSet.size() > 1)
lineChartView.show(anim);
else
Toast.makeText(this, "No data", Toast.LENGTH_SHORT).show();
}
开发者ID:vycius,项目名称:udacity-stock-hawk,代码行数:38,代码来源:StockDetailActivity.java
示例7: temperatureGraph
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void temperatureGraph() {
LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_temperature);
// Data
LineSet dataset = new LineSet();
for (int i = 0; i < weatherList.size(); i++) {
float temperature = UnitConvertor.convertTemperature(Float.parseFloat(weatherList.get(i).getTemperature()), sp);
if (temperature < minTemp) {
minTemp = temperature;
}
if (temperature > maxTemp) {
maxTemp = temperature;
}
dataset.addPoint(getDateLabel(weatherList.get(i), i), (float) temperature);
}
dataset.setSmooth(false);
dataset.setColor(Color.parseColor("#FF5722"));
dataset.setThickness(4);
lineChartView.addData(dataset);
// Grid
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(Color.parseColor("#333333"));
paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
paint.setStrokeWidth(1);
lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
lineChartView.setAxisBorderValues((int) (Math.round(minTemp)) - 1, (int) (Math.round(maxTemp)) + 1);
lineChartView.setStep(2);
lineChartView.setXAxis(false);
lineChartView.setYAxis(false);
lineChartView.show();
}
开发者ID:martykan,项目名称:forecastie,代码行数:41,代码来源:GraphActivity.java
示例8: rainGraph
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void rainGraph() {
LineChartView lineChartView = (LineChartView) findViewById(R.id.graph_rain);
// Data
LineSet dataset = new LineSet();
for (int i = 0; i < weatherList.size(); i++) {
float rain = Float.parseFloat(weatherList.get(i).getRain());
if (rain < minRain) {
minRain = rain;
}
if (rain > maxRain) {
maxRain = rain;
}
dataset.addPoint(getDateLabel(weatherList.get(i), i), rain);
}
dataset.setSmooth(false);
dataset.setColor(Color.parseColor("#2196F3"));
dataset.setThickness(4);
lineChartView.addData(dataset);
// Grid
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(Color.parseColor("#333333"));
paint.setPathEffect(new DashPathEffect(new float[]{10, 10}, 0));
paint.setStrokeWidth(1);
lineChartView.setGrid(ChartView.GridType.HORIZONTAL, paint);
lineChartView.setBorderSpacing(Tools.fromDpToPx(10));
lineChartView.setAxisBorderValues(0, (int) (Math.round(maxRain)) + 1);
lineChartView.setStep(1);
lineChartView.setXAxis(false);
lineChartView.setYAxis(false);
lineChartView.show();
}
开发者ID:martykan,项目名称:forecastie,代码行数:41,代码来源:GraphActivity.java
示例9: initChart
import com.db.chart.model.LineSet; //导入依赖的package包/类
private void initChart(){
final Tooltip tooltip = new Tooltip(getActivity(), R.layout.tool_tip_chart, R.id.value);
tooltip.setVerticalAlignment(Tooltip.Alignment.BOTTOM_TOP);
tooltip.setDimensions((int) Tools.fromDpToPx(65), (int) Tools.fromDpToPx(25));
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tooltip.setEnterAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 1),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 1f)).setDuration(200);
tooltip.setExitAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 0),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f),
PropertyValuesHolder.ofFloat(View.SCALE_X, 0f)).setDuration(200);
tooltip.setPivotX(Tools.fromDpToPx(65) / 2);
tooltip .setPivotY(Tools.fromDpToPx(25));
}
amountChart.setTooltips(tooltip);
LineSet dataset = new LineSet(ChartDetailHelper.getInstance().getLabels(), ChartDetailHelper.getInstance().getValues());
dataset.setColor(Color.WHITE)
.setFill(getResources().getColor(android.R.color.holo_orange_light))
.setDotsColor(Color.WHITE)
.setThickness(4)
.setDashed(new float[]{10f,10f})
.beginAt(1)
.endAt(8);
amountChart.addData(dataset);
Log.d(getClass().getName(), "initChart: "+Math.round(max/10));
amountChart.setStep(ChartDetailHelper.getInstance().getMaxRatio());
amountChart.setFontSize((int) (getResources().getDimension(R.dimen.dp_30)/getResources().getDisplayMetrics().density));
amountChart.setLabelsColor(Color.WHITE);
Runnable chartAction = new Runnable() {
@Override
public void run() {
tooltip.prepare(amountChart.getEntriesArea(0).get(3), values[0]);
amountChart.showTooltip(tooltip, true);
}
};
Animation anim = new Animation()
.setEasing(new BounceEase())
.setEndAction(chartAction);
amountChart.show(anim);
}
开发者ID:ReiiYuki,项目名称:kebthung,代码行数:45,代码来源:ChartFragment.java
注:本文中的com.db.chart.model.LineSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论