本文整理汇总了Java中com.github.mikephil.charting.charts.BarLineChartBase类的典型用法代码示例。如果您正苦于以下问题:Java BarLineChartBase类的具体用法?Java BarLineChartBase怎么用?Java BarLineChartBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BarLineChartBase类属于com.github.mikephil.charting.charts包,在下文中一共展示了BarLineChartBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
@Override
public void run() {
Matrix save = mRunMatrixBuffer;
mViewPortHandler.zoom(scaleX, scaleY, save);
mViewPortHandler.refresh(save, view, false);
float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY();
float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX();
pts[0] = xValue - xValsInView / 2f;
pts[1] = yValue + yValsInView / 2f;
mTrans.pointValuesToPixel(pts);
mViewPortHandler.translate(pts, save);
mViewPortHandler.refresh(save, view, false);
((BarLineChartBase) view).calculateOffsets();
view.postInvalidate();
recycleInstance(this);
}
示例2: setup
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
/**
* 设置字体
*
* @param chart
*/
protected void setup(Chart<?> chart) {
mTy = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
chart.setDescription("");
chart.setNoDataTextDescription("You need to provide data for the chart.");
chart.setTouchEnabled(true);
if (chart instanceof BarLineChartBase) {
BarLineChartBase mChart = (BarLineChartBase) chart;
mChart.setDrawGridBackground(false);
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.setTypeface(mTy);
leftAxis.setTextSize(8f);
leftAxis.setTextColor(Color.WHITE);
XAxis xAxis = mChart.getXAxis();
xAxis.setLabelRotationAngle(-50);//设置x轴字体显示角度
xAxis.setTypeface(mTy);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(8f);
xAxis.setTextColor(Color.WHITE);
mChart.getAxisRight().setEnabled(false);
}
}
示例3: run
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
@Override
public void run() {
Matrix save = mViewPortHandler.zoom(scaleX, scaleY);
mViewPortHandler.refresh(save, view, false);
float valsInView = ((BarLineChartBase) view).getDeltaY(axisDependency) / mViewPortHandler.getScaleY();
float xsInView = ((BarLineChartBase) view).getXAxis().getValues().size() / mViewPortHandler.getScaleX();
pts[0] = xValue - xsInView / 2f;
pts[1] = yValue + valsInView / 2f;
mTrans.pointValuesToPixel(pts);
save = mViewPortHandler.translate(pts);
mViewPortHandler.refresh(save, view, false);
((BarLineChartBase) view).calculateOffsets();
view.postInvalidate();
}
示例4: setZoom
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
@ReactProp(name = "zoom")
public void setZoom(BarLineChartBase chart, ReadableMap propMap) {
if (BridgeUtils.validate(propMap, ReadableType.Number, "scaleX") &&
BridgeUtils.validate(propMap, ReadableType.Number, "scaleY") &&
BridgeUtils.validate(propMap, ReadableType.Number, "xValue") &&
BridgeUtils.validate(propMap, ReadableType.Number, "yValue")) {
YAxis.AxisDependency axisDependency = YAxis.AxisDependency.LEFT;
if (propMap.hasKey("axisDependency") &&
propMap.getString("axisDependency").equalsIgnoreCase("RIGHT")) {
axisDependency = YAxis.AxisDependency.RIGHT;
}
chart.zoom(
(float) propMap.getDouble("scaleX"),
(float) propMap.getDouble("scaleY"),
(float) propMap.getDouble("xValue"),
(float) propMap.getDouble("yValue"),
axisDependency
);
}
}
示例5: BarLineChartTouchListener
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
/**
* Constructor with initialization parameters.
*
* @param chart instance of the chart
* @param touchMatrix the touch-matrix of the chart
* @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals
* to about 9 pixels on a 5.5" FHD screen)
*/
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends
IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) {
super(chart);
this.mMatrix = touchMatrix;
this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance);
this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
示例6: setup
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
protected void setup(Chart<?> chart) {
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
// no description text
chart.getDescription().setEnabled(false);
// enable touch gestures
chart.setTouchEnabled(true);
if (chart instanceof BarLineChartBase) {
BarLineChartBase mChart = (BarLineChartBase) chart;
mChart.setDrawGridBackground(false);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.setTypeface(mTf);
leftAxis.setTextSize(8f);
leftAxis.setTextColor(Color.DKGRAY);
leftAxis.setValueFormatter(new PercentFormatter());
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(mTf);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(8f);
xAxis.setTextColor(Color.DKGRAY);
mChart.getAxisRight().setEnabled(false);
}
}
示例7: setupYAxes
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
private void setupYAxes(BarLineChartBase chart) {
YAxis y = chart.getAxisLeft();
y.setDrawZeroLine(true);
y.setDrawLabels(false);
y.setDrawGridLines(false);
y.setDrawAxisLine(false);
y.setAxisMinimum(0);
y = chart.getAxisRight();
y.setDrawZeroLine(true);
y.setDrawLabels(false);
y.setDrawGridLines(false);
y.setDrawAxisLine(false);
y.setAxisMinimum(0);
}
示例8: setupXAxis
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
private void setupXAxis(BarLineChartBase chart, IAxisValueFormatter formatter) {
XAxis x = chart.getXAxis();
x.setGranularity(1.0f);
x.setDrawGridLines(false);
x.setPosition(XAxis.XAxisPosition.BOTTOM);
x.setDrawAxisLine(false);
x.setCenterAxisLabels(true);
x.setAxisMinimum(2.0f);
x.setAxisMaximum(5.0f);
x.setValueFormatter(formatter);
}
示例9: setup
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
protected void setup(Chart<?> chart) {
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
// no description text
chart.setDescription("");
chart.setNoDataTextDescription("You need to provide data for the chart.");
// enable touch gestures
chart.setTouchEnabled(true);
if (chart instanceof BarLineChartBase) {
BarLineChartBase mChart = (BarLineChartBase) chart;
mChart.setDrawGridBackground(false);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.setTypeface(mTf);
leftAxis.setTextSize(8f);
leftAxis.setTextColor(Color.WHITE);
// leftAxis.setValueFormatter(new PercentFormatter());
XAxis xAxis = mChart.getXAxis();
xAxis.setLabelRotationAngle(-50);//设置x轴字体显示角度
xAxis.setTypeface(mTf);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(8f);
xAxis.setTextColor(Color.WHITE);
mChart.getAxisRight().setEnabled(false);
}
}
示例10: setup
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
protected void setup(Chart<?> chart) {
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
// no description text
chart.setDescription("");
chart.setNoDataTextDescription("You need to provide data for the chart.");
// enable touch gestures
chart.setTouchEnabled(true);
if (chart instanceof BarLineChartBase) {
BarLineChartBase mChart = (BarLineChartBase) chart;
mChart.setDrawGridBackground(false);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(false);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
leftAxis.setTypeface(mTf);
leftAxis.setTextSize(8f);
leftAxis.setTextColor(Color.DKGRAY);
leftAxis.setValueFormatter(new PercentFormatter());
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(mTf);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(8f);
xAxis.setTextColor(Color.DKGRAY);
mChart.getAxisRight().setEnabled(false);
}
}
示例11: BarLineChartTouchListener
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) {
super(chart);
this.mMatrix = touchMatrix;
// this equals to about 9 pixels on a 5.5" FHD screen
this.mDragTriggerDist = Utils.convertDpToPixel(3f);
this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f);
}
示例12: setYAxis
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
@Override
public void setYAxis(Chart chart, ReadableMap propMap) {
BarLineChartBase barLineChart = (BarLineChartBase) chart;
if (BridgeUtils.validate(propMap, ReadableType.Map, "left")) {
YAxis leftYAxis = barLineChart.getAxisLeft();
setCommonAxisConfig(chart, leftYAxis, propMap.getMap("left"));
setYAxisConfig(leftYAxis, propMap.getMap("left"));
}
if (BridgeUtils.validate(propMap, ReadableType.Map, "right")) {
YAxis rightYAxis = barLineChart.getAxisRight();
setCommonAxisConfig(chart, rightYAxis, propMap.getMap("right"));
setYAxisConfig(rightYAxis, propMap.getMap("right"));
}
}
示例13: configureBarLineChartDefaults
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
protected void configureBarLineChartDefaults(BarLineChartBase<?> chart) {
configureChartDefaults(chart);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
// chart.setPinchZoom(true);
chart.setDrawGridBackground(false);
}
示例14: onCreateView
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_charts, container, false);
mChart = (BarLineChartBase) rootView.findViewById(R.id.activitysleepchart);
setupChart();
return rootView;
}
示例15: setChartStyle
import com.github.mikephil.charting.charts.BarLineChartBase; //导入依赖的package包/类
/**
* Sets basic chart styles.
*
* @param chart LineChart where basic styles will be applied.
*/
private void setChartStyle(BarLineChartBase<?> chart) {
// general style
chart.setPinchZoom(false);
chart.setScaleEnabled(false);
chart.setDoubleTapToZoomEnabled(false);
chart.setDescription("");
chart.setDrawBorders(false);
chart.setDrawGridBackground(false);
chart.getLegend().setEnabled(false);
chart.setExtraLeftOffset(16);
chart.setExtraRightOffset(16);
// set x-axis
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setSpaceBetweenLabels(0);
xAxis.setDrawAxisLine(false);
xAxis.setDrawGridLines(false);
xAxis.setTextColor(ContextCompat.getColor(getContext(), R.color.text87));
// show left y-axis
YAxis leftYAxis = chart.getAxisLeft();
leftYAxis.setDrawGridLines(true);
leftYAxis.setGridColor(ContextCompat.getColor(getContext(), R.color.divider));
leftYAxis.setDrawAxisLine(false);
leftYAxis.setDrawLabels(false);
leftYAxis.setLabelCount(6, true);
// hide right y-axis
YAxis rightYAxis = chart.getAxisRight();
rightYAxis.setDrawGridLines(false);
rightYAxis.setDrawAxisLine(false);
rightYAxis.setDrawLabels(false);
}