本文整理汇总了Java中com.github.mikephil.charting.components.YAxis.setTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java YAxis.setTextSize方法的具体用法?Java YAxis.setTextSize怎么用?Java YAxis.setTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.components.YAxis
的用法示例。
在下文中一共展示了YAxis.setTextSize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAxis
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public void setAxis(AnalysisXAxisValueFormatter formatter, float yAxisMaxValue) {
XAxis xAxis = mRadarChart.getXAxis();
xAxis.setTextSize(9f);
xAxis.setYOffset(0f);
xAxis.setXOffset(0f);
xAxis.setValueFormatter(formatter);
xAxis.setTextColor(Color.WHITE);
YAxis yAxis = mRadarChart.getYAxis();
yAxis.setLabelCount(5, false);
yAxis.setTextSize(9f);
yAxis.setAxisMinimum(0f);
yAxis.setAxisMaximum(yAxisMaxValue);
yAxis.setDrawLabels(false);
Legend l = mRadarChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
l.setTextColor(Color.WHITE);
}
示例2: setup
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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: setup
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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);
}
}
示例4: setup
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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);
}
}
示例5: setup
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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);
}
}
示例6: initChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void initChart(BarChart chart) {
float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
chart.setDragEnabled(true);
chart.setScaleYEnabled(false);
chart.setScaleXEnabled(false);
chart.setDoubleTapToZoomEnabled(false);
chart.setPinchZoom(false);
chart.setHighlightPerDragEnabled(false);
chart.setHighlightPerTapEnabled(false);
chart.setDrawGridBackground(false);
chart.setDrawBorders(false);
chart.setDrawValueAboveBar(false);
chart.getAxisLeft().setEnabled(false);
XAxis xAxis = chart.getXAxis();
xAxis.setDrawAxisLine(true);
xAxis.setDrawGridLines(false);
xAxis.setDrawLabels(false);
xAxis.setDrawLimitLinesBehindData(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
YAxis yAxis = chart.getAxisRight();
yAxis.setDrawAxisLine(false);
yAxis.setStartAtZero(false);
yAxis.setSpaceTop(10f);
yAxis.setSpaceBottom(0f);
yAxis.setTextSize(10 * scaledDensity);
yAxis.setTextColor(ContextCompat.getColor(this, R.color.text));
chart.getLegend().setEnabled(false);
chart.setDescription(" ");
chart.setNoDataText("Can't see sh*t captain!");
Paint p = chart.getPaint(Chart.PAINT_INFO);
DisplayMetrics dm = getResources().getDisplayMetrics();
int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 18, dm); //TODO use styles
p.setTextSize(size);
p.setColor(ContextCompat.getColor(this, R.color.gray600));
p.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
示例7: initChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* 初始化图表
*
* @param chart 原始图表
* @return 初始化后的图表
*/
public static LineChart initChart(LineChart chart) {
// 不显示数据描述
chart.getDescription().setEnabled(false);
// 没有数据的时候,显示“暂无数据”
chart.setNoDataText("暂无数据");
// 不显示表格颜色
chart.setDrawGridBackground(false);
// 不可以缩放
chart.setScaleEnabled(false);
// 不显示y轴右边的值
chart.getAxisRight().setEnabled(false);
// 不显示图例
Legend legend = chart.getLegend();
legend.setEnabled(false);
// 向左偏移15dp,抵消y轴向右偏移的30dp
chart.setExtraLeftOffset(-15);
XAxis xAxis = chart.getXAxis();
// 不显示x轴
xAxis.setDrawAxisLine(false);
// 设置x轴数据的位置
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextColor(Color.WHITE);
xAxis.setTextSize(12);
xAxis.setGridColor(Color.parseColor("#30FFFFFF"));
// 设置x轴数据偏移量
xAxis.setYOffset(-12);
YAxis yAxis = chart.getAxisLeft();
// 不显示y轴
yAxis.setDrawAxisLine(false);
// 设置y轴数据的位置
yAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
// 不从y轴发出横向直线
yAxis.setDrawGridLines(false);
yAxis.setTextColor(Color.WHITE);
yAxis.setTextSize(12);
// 设置y轴数据偏移量
yAxis.setXOffset(30);
yAxis.setYOffset(-3);
yAxis.setAxisMinimum(0);
//Matrix matrix = new Matrix();
// x轴缩放1.5倍
//matrix.postScale(1.5f, 1f);
// 在图表动画显示之前进行缩放
//chart.getViewPortHandler().refresh(matrix, chart, false);
// x轴执行动画
//chart.animateX(2000);
chart.invalidate();
return chart;
}
示例8: onCreate
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_radarchart_noseekbar);
TextView tv = (TextView) findViewById(R.id.textView);
tv.setTypeface(mTfLight);
tv.setTextColor(Color.WHITE);
tv.setBackgroundColor(Color.rgb(60, 65, 82));
mChart = (RadarChart) findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.rgb(60, 65, 82));
mChart.getDescription().setEnabled(false);
mChart.setWebLineWidth(1f);
mChart.setWebColor(Color.LTGRAY);
mChart.setWebLineWidthInner(1f);
mChart.setWebColorInner(Color.LTGRAY);
mChart.setWebAlpha(100);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MarkerView mv = new RadarMarkerView(this, R.layout.radar_markerview);
mv.setChartView(mChart); // For bounds control
mChart.setMarker(mv); // Set the marker to the chart
setData();
mChart.animateXY(
1400, 1400,
Easing.EasingOption.EaseInOutQuad,
Easing.EasingOption.EaseInOutQuad);
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(mTfLight);
xAxis.setTextSize(9f);
xAxis.setYOffset(0f);
xAxis.setXOffset(0f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
private String[] mActivities = new String[]{"Burger", "Steak", "Salad", "Pasta", "Pizza"};
@Override
public String getFormattedValue(float value, AxisBase axis) {
return mActivities[(int) value % mActivities.length];
}
});
xAxis.setTextColor(Color.WHITE);
YAxis yAxis = mChart.getYAxis();
yAxis.setTypeface(mTfLight);
yAxis.setLabelCount(5, false);
yAxis.setTextSize(9f);
yAxis.setAxisMinimum(0f);
yAxis.setAxisMaximum(80f);
yAxis.setDrawLabels(false);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setTypeface(mTfLight);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
l.setTextColor(Color.WHITE);
}
示例9: onCreateView
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_lastscanchart, container, false);
LineChart cv_LastScan = (LineChart) view.findViewById(R.id.cv_LastScan);
cv_LastScan.setOnChartGestureListener(new myChartGestureListener(cv_LastScan));
XAxis xAxis = cv_LastScan.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setTextSize(10f);
xAxis.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
xAxis.enableGridDashedLine(5f, 5f, 0f);
xAxis.setDrawLimitLinesBehindData(true);
YAxis yAxisLeft = cv_LastScan.getAxisLeft();
YAxis yAxisRight = cv_LastScan.getAxisRight();
yAxisRight.setEnabled(false);
yAxisLeft.setTextSize(18f); // set the textsize
yAxisLeft.setTextColor(getResources().getColor(R.color.colorGlucoseNow));
yAxisLeft.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
yAxisLeft.setStartAtZero(true);
yAxisLeft.setYOffset(-6f);
yAxisLeft.setAxisMinValue(0.0f);
Legend legend = cv_LastScan.getLegend();
legend.setEnabled(false);
// no description text
cv_LastScan.setDescription("");
cv_LastScan.setNoDataText(getResources().getString(R.string.no_data));
cv_LastScan.setNoDataTextDescription("");
// enable touch gestures
cv_LastScan.setTouchEnabled(true);
// enable scaling and dragging
cv_LastScan.setDragEnabled(true);
cv_LastScan.setScaleEnabled(true);
cv_LastScan.setDrawGridBackground(false);
// if disabled, scaling can be done on x- and y-axis separately
cv_LastScan.setPinchZoom(true);
MyMarkerView mv = new MyMarkerView(view.getContext(), R.layout.custom_marker_view);
// set the marker to the chart
cv_LastScan.setMarkerView(mv);
try {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
cv_LastScan.setHardwareAccelerationEnabled(false);
} else {
cv_LastScan.setHardwareAccelerationEnabled(true);
}
} catch (Exception e) {
}
refresh();
return (view);
}
示例10: onCreate
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_radarchart);
mChart = (RadarChart) findViewById(R.id.chart1);
tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart.setDescription("");
mChart.setWebLineWidth(1.5f);
mChart.setWebLineWidthInner(0.75f);
mChart.setWebAlpha(100);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
// set the marker to the chart
mChart.setMarkerView(mv);
setData();
mChart.animateXY(
1400, 1400,
Easing.EasingOption.EaseInOutQuad,
Easing.EasingOption.EaseInOutQuad);
XAxis xAxis = mChart.getXAxis();
xAxis.setTypeface(tf);
xAxis.setTextSize(9f);
YAxis yAxis = mChart.getYAxis();
yAxis.setTypeface(tf);
yAxis.setLabelCount(5, false);
yAxis.setTextSize(9f);
yAxis.setAxisMinValue(0f);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
l.setTypeface(tf);
l.setXEntrySpace(7f);
l.setYEntrySpace(5f);
}
示例11: updateLineChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public static LineChart updateLineChart(LineChart chart, int max, List<Entry> entries, List<String> xValues)
{
Resources res = chart.getContext().getResources();
chart.setDrawBorders(false);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawAxisLine(false);
xAxis.setYOffset(32f);
xAxis.setDrawGridLines(false);
xAxis.setLabelsToSkip(0);
xAxis.setTextSize(14);
xAxis.setTextColor(res.getColor(R.color.mm_warm_grey));
xAxis.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
YAxis yAxis = chart.getAxisLeft();
yAxis.setDrawAxisLine(false);
yAxis.setDrawGridLines(false);
yAxis.setDrawZeroLine(false);
yAxis.setAxisMaxValue(max + 2);
yAxis.setAxisMinValue(0);
yAxis.setShowOnlyMinMax(true);
yAxis.setTextSize(14);
yAxis.setTextColor(res.getColor(R.color.mm_warm_grey));
yAxis.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
chart.getAxisRight().setEnabled(false);
chart.getLegend().setEnabled(false);
chart.setDescription("");
LineDataSet set = new LineDataSet(entries, "");
set.setCircleColor(res.getColor(R.color.mm_colorPrimary));
set.setCircleRadius(4f);
set.setDrawCircleHole(false);
set.setColor(res.getColor(R.color.mm_colorPrimary));
set.setLineWidth(2f);
set.setDrawValues(false);
LineData data = new LineData(xValues, set);
chart.setData(data);
chart.setVisibleXRange(0, 7);
return chart;
}
示例12: setLineChartStylingAndRefreshChart
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
* Set the line charts styling
*
* @param lineData the data to style
*/
private void setLineChartStylingAndRefreshChart(LineData lineData) {
// style axis
YAxis leftAxis = chart.getAxisLeft();
leftAxis.setAxisMinValue(0f);
leftAxis.setDrawGridLines(false);
leftAxis.setTextSize(15);
YAxis rightAxis = chart.getAxisRight();
rightAxis.setDrawLabels(false);
rightAxis.setDrawGridLines(false);
XAxis xAxis = chart.getXAxis();
xAxis.setDrawGridLines(false);
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawLabels(false);
// add threshold limit line
String thresholdDescription = "";
LimitLine limitLine = new LimitLine(100f, thresholdDescription);
limitLine.setLineColor(Color.RED);
limitLine.setLineWidth(1f);
limitLine.setTextColor(Color.RED);
limitLine.setTextSize(15f);
if (leftAxis.getLimitLines().size() < 1)
leftAxis.addLimitLine(limitLine);
// add legend
Legend l = chart.getLegend();
l.setFormSize(10f);
l.setForm(Legend.LegendForm.CIRCLE);
l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
l.setTextSize(12f);
l.setTextColor(Color.BLACK);
l.setXEntrySpace(5f);
l.setYEntrySpace(5f);
String[] labels = {Strings.getStringByRId(R.string.median_performance), Strings.getStringByRId(R.string.median_performance_forecast), Strings.getStringByRId(R.string.pre_operation_performance)};
int[] colors = {ContextCompat.getColor(activity.getApplicationContext(), R.color.colorPrimary), ContextCompat.getColor(activity.getApplicationContext(), R.color.colorPrimaryLight), Color.RED};
l.setCustom(colors, labels);
// style chart and refresh
chart.setDescription("");
chart.setPinchZoom(false);
chart.setDoubleTapToZoomEnabled(false);
chart.setDrawGridBackground(false);
chart.setData(lineData);
chart.invalidate();
}