本文整理汇总了Java中com.github.mikephil.charting.data.LineDataSet.setFillAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java LineDataSet.setFillAlpha方法的具体用法?Java LineDataSet.setFillAlpha怎么用?Java LineDataSet.setFillAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.LineDataSet
的用法示例。
在下文中一共展示了LineDataSet.setFillAlpha方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, "Dynamic Data");
set.setAxisDependency(AxisDependency.LEFT);
set.setColor(ColorTemplate.getHoloBlue());
set.setCircleColor(Color.WHITE);
set.setLineWidth(2f);
set.setCircleRadius(4f);
set.setFillAlpha(65);
set.setFillColor(ColorTemplate.getHoloBlue());
set.setHighLightColor(Color.rgb(244, 117, 117));
set.setValueTextColor(Color.WHITE);
set.setValueTextSize(9f);
set.setDrawValues(false);
return set;
}
示例2: createSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, getString(R.string.app_name));
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setColor(ColorTemplate.getHoloBlue());
set.setCircleColor(Color.WHITE);
set.setLineWidth(1f);
set.setCircleRadius(1.5f);
set.setFillAlpha(65);
set.setFillColor(ColorTemplate.getHoloBlue());
set.setHighLightColor(Color.rgb(244, 117, 117));
set.setValueTextColor(Color.WHITE);
set.setValueTextSize(9f);
set.setDrawValues(false);
return set;
}
示例3: createSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, "BG Data");
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setColor(ColorTemplate.getHoloBlue());
set.setCircleColor(Color.WHITE);
set.setLineWidth(2f);
set.setCircleRadius(3f);
set.setFillAlpha(65);
set.setFillColor(ColorTemplate.getHoloBlue());
set.setHighLightColor(Color.rgb(244, 117, 117));
set.setValueTextColor(Color.WHITE);
set.setValueTextSize(9f);
set.setDrawValues(false);
//set.setColors(ColorTemplate.COLORFUL_COLORS);
//set.setColors(ColorTemplate.VORDIPLOM_COLORS);
//set.setColors(ColorTemplate.JOYFUL_COLORS);
//set.setColors(ColorTemplate.LIBERTY_COLORS);
//set.setColors(ColorTemplate.PASTEL_COLORS);
//set.setDrawCubic(chartcubic);
return set;
}
示例4: styleChartLines
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
/**
* Style char lines (type, color, etc.).
*
* @param entries list of entries.
* @return line data chart.
*/
private LineData styleChartLines(List<Entry> entries) {
// Set styles
LineDataSet lineDataSet = new LineDataSet(entries, "Recording");
lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
lineDataSet.setCubicIntensity(0.2f);
lineDataSet.setDrawValues(false);
lineDataSet.setDrawCircles(false);
lineDataSet.setLineWidth(1.8f);
lineDataSet.setColor(ContextCompat.getColor(context, R.color.colorAccent));
if (((int) lineDataSet.getYMax()) != 0) {
lineDataSet.setDrawFilled(true);
lineDataSet.setFillAlpha(255);
// Fix bug with vectors in API < 21
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){
Drawable drawable = ResourcesCompat.getDrawable(context.getResources(),
R.drawable.chart_fade, null);
lineDataSet.setFillDrawable(drawable);
} else{
lineDataSet.setFillColor(ContextCompat.getColor(context, R.color.colorPrimary));
}
}
return new LineData(lineDataSet);
}
示例5: createSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet createSet() {
LineDataSet set = new LineDataSet(null, "Dynamic Data");
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setColor(ColorTemplate.getHoloBlue());
set.setCircleColor(Color.WHITE);
set.setLineWidth(2f);
set.setCircleRadius(4f);
set.setFillAlpha(65);
set.setFillColor(ColorTemplate.getHoloBlue());
set.setHighLightColor(Color.rgb(244, 117, 117));
set.setValueTextColor(Color.WHITE);
set.setValueTextSize(9f);
set.setDrawValues(false);
return set;
}
示例6: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {
// now in hours
long now = TimeUnit.MILLISECONDS.toHours(System.currentTimeMillis());
ArrayList<Entry> values = new ArrayList<Entry>();
float from = now;
// count = hours
float to = now + count;
// increment by 1 hour
for (float x = from; x < to; x++) {
float y = getRandom(range, 50);
values.add(new Entry(x, y)); // add one entry per hour
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(values, "DataSet 1");
set1.setAxisDependency(AxisDependency.LEFT);
set1.setColor(ColorTemplate.getHoloBlue());
set1.setValueTextColor(ColorTemplate.getHoloBlue());
set1.setLineWidth(1.5f);
set1.setDrawCircles(false);
set1.setDrawValues(false);
set1.setFillAlpha(65);
set1.setFillColor(ColorTemplate.getHoloBlue());
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setDrawCircleHole(false);
// create a data object with the datasets
LineData data = new LineData(set1);
data.setValueTextColor(Color.WHITE);
data.setValueTextSize(9f);
// set data
mChart.setData(data);
}
示例7: setupDatasetWithDefaultValues
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setupDatasetWithDefaultValues(LineDataSet dataSet) {
dataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
dataSet.setColor(ColorTemplate.getHoloBlue());
dataSet.setValueTextColor(ColorTemplate.getHoloBlue());
dataSet.setLineWidth(1.5f);
dataSet.setDrawCircles(false);
dataSet.setDrawValues(false);
dataSet.setFillAlpha(65);
dataSet.setFillColor(ColorTemplate.getHoloBlue());
dataSet.setHighLightColor(Color.rgb(244, 117, 117));
dataSet.setDrawCircleHole(false);
}
示例8: createSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet createSet()
{
LineDataSet set=new LineDataSet(null, "Data");
set.setDrawCircles(true);
set.setAxisDependency(YAxis.AxisDependency.LEFT);
set.setColor(ColorTemplate.getHoloBlue());
set.setCircleColor(ColorTemplate.getHoloBlue());
set.setLineWidth(2f);
set.setCircleRadius(4f);
set.setFillAlpha(65);
set.setFillColor(ColorTemplate.getHoloBlue());
set.setHighLightColor(Color.rgb(244,117,177));
return set;
}
示例9: marshallHumidity
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void marshallHumidity(List<HumidityHolder> humidity) {
final int count = humidity.size();
List<String> xVals = new ArrayList<>();
List<Entry> humidityList = new ArrayList<>();
for(int i = 0; i < count; ++i) {
HumidityHolder humidityHolder = humidity.get(i);
xVals.add(humidityHolder.getDate());
humidityList.add(new Entry(humidityHolder.getHumidity(), i));
}
LineDataSet lineDataSet = new LineDataSet(humidityList, "湿度");
lineDataSet.setDrawCubic(true);
lineDataSet.setDrawFilled(true);
lineDataSet.setDrawCircles(false);
lineDataSet.setCircleColor(Color.WHITE);
lineDataSet.setHighLightColor(m_context.getResources().getColor(R.color.max));
lineDataSet.setColor(Color.WHITE);
lineDataSet.setFillColor(m_context.getResources().getColor(R.color.fill));
lineDataSet.setFillAlpha(100);
LineData data = new LineData(xVals, lineDataSet);
data.setValueTextSize(5f);
m_iWeatherForecastView.showHumidity(data);
}
示例10: configureWeatherChart
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
/**
* Configure styles of weather charts.
*
* @param entries chart data.
* @param formatter value formatter.
* @param minVal min value to show.
* @param maxVal max value to show.
* @return chart formatted.
*/
private LineDataSet configureWeatherChart(
LineChart chart, int chartName, int colorLineTempChart, int colorFillTempChart,
List<Entry> entries, IAxisValueFormatter formatter, double minVal, double maxVal) {
LineDataSet lineDataSet = new LineDataSet(entries, getString(chartName));
lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
lineDataSet.setDrawValues(false);
lineDataSet.setValueTextSize(10f);
lineDataSet.setDrawCircles(false);
lineDataSet.setLineWidth(1.8f);
lineDataSet.setColor(ContextCompat.getColor(getContext(), colorLineTempChart));
lineDataSet.setLineWidth(2f);
lineDataSet.setDrawFilled(true);
lineDataSet.setFillColor(ContextCompat.getColor(getContext(), colorFillTempChart));
lineDataSet.setFillAlpha(255);
// General setup
chart.setDrawGridBackground(false);
chart.setDrawBorders(false);
chart.setViewPortOffsets(0, 0, 0, 0);
chart.getDescription().setEnabled(false);
chart.getLegend().setEnabled(false);
chart.setTouchEnabled(false);
// X axis setup
XAxis xAxis = chart.getXAxis();
xAxis.setEnabled(false);
xAxis.setAxisMinimum(0);
xAxis.setAxisMaximum(lastTimestamp);
// Y axis setup
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setEnabled(false);
leftAxis.setAxisMaximum((float) (maxVal));
leftAxis.setAxisMinimum((float) (minVal));
YAxis rightAxis = chart.getAxisRight();
rightAxis.setAxisMaximum((float) (maxVal));
rightAxis.setAxisMinimum((float) (minVal));
rightAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
rightAxis.setValueFormatter(formatter);
return lineDataSet;
}
示例11: setupGraphic
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setupGraphic(LineChart chart, List<Entry> entries, float axisMinimum, IAxisValueFormatter formatter) {
LineDataSet dataSet = new LineDataSet(entries, Constants.EMPTY_STRING);
dataSet.setDrawCircles(false);
dataSet.setDrawCircleHole(false);
dataSet.setLineWidth(ResourcesHelper.getDimensionPixelSize(this, R.dimen.half_dp));
dataSet.setFillColor(getResources().getColor(R.color.colorPrimary));
dataSet.setDrawFilled(true);
dataSet.setFillAlpha(Constants.Chart.ALPHA_FILL);
dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
dataSet.setColor(getResources().getColor(R.color.colorPrimary));
dataSet.setDrawValues(false);
LineData lineData = new LineData(dataSet);
chart.getDescription().setEnabled(false);
chart.setTouchEnabled(false);
chart.getLegend().setEnabled(false);
chart.getAxisRight().setEnabled(false);
chart.getXAxis().setDrawLabels(false);
chart.getXAxis().setDrawGridLines(false);
chart.getAxisLeft().removeAllLimitLines();
chart.getAxisLeft().setTextColor(getResources().getColor(R.color.gray));
chart.getAxisLeft().setAxisMinimum(axisMinimum);
chart.getAxisLeft().setTextSize(Constants.Chart.LABEL_SIZE);
chart.getAxisLeft().setValueFormatter(formatter);
chart.animateX(Constants.Chart.ANIMATION_DURATION, Easing.EasingOption.EaseInSine);
chart.setData(lineData);
chart.invalidate();
}
示例12: generateLineDataSet
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private LineDataSet generateLineDataSet(List<Entry> yVals, int color) {
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(yVals, "");
List<Integer> colors = new ArrayList<>();
if (color == getResources().getColor(R.color.glucosio_pink)) {
for (Entry yVal : yVals) {
if (yVal.getVal() == (0)) {
colors.add(Color.TRANSPARENT);
} else {
colors.add(color);
}
}
set1.setCircleColors(colors);
} else {
set1.setCircleColor(color);
}
set1.setColor(color);
set1.setLineWidth(2f);
set1.setCircleSize(4f);
set1.setDrawCircleHole(true);
set1.disableDashedLine();
set1.setFillAlpha(255);
set1.setDrawFilled(true);
set1.setValueTextSize(0);
set1.setValueTextColor(Color.parseColor("#FFFFFF"));
set1.setFillDrawable(getResources().getDrawable(R.drawable.graph_gradient));
set1.setHighLightColor(getResources().getColor(R.color.glucosio_gray_light));
set1.setCubicIntensity(0.2f);
// TODO: Change this to true when a fix is available
// https://github.com/PhilJay/MPAndroidChart/issues/1541
set1.setDrawCubic(false);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
set1.setDrawFilled(false);
set1.setLineWidth(2f);
set1.setCircleSize(4f);
set1.setDrawCircleHole(true);
}
return set1;
}
示例13: setData
import com.github.mikephil.charting.data.LineDataSet; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((1990 +i) + "");
}
ArrayList<Entry> vals1 = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 20;// + (float)
// ((mult *
// 0.1) / 10);
vals1.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
set1.setDrawCubic(true);
set1.setCubicIntensity(0.2f);
//set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(1.8f);
set1.setCircleRadius(4f);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.WHITE);
set1.setFillColor(Color.WHITE);
set1.setFillAlpha(100);
set1.setDrawHorizontalHighlightIndicator(false);
set1.setFillFormatter(new FillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
return -10;
}
});
// create a data object with the datasets
LineData data = new LineData(xVals, set1);
data.setValueTypeface(tf);
data.setValueTextSize(9f);
data.setDrawValues(false);
// set data
mChart.setData(data);
}