本文整理汇总了Java中com.github.mikephil.charting.components.YAxis.setInverted方法的典型用法代码示例。如果您正苦于以下问题:Java YAxis.setInverted方法的具体用法?Java YAxis.setInverted怎么用?Java YAxis.setInverted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.components.YAxis
的用法示例。
在下文中一共展示了YAxis.setInverted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
// no description text
mChart.getDescription().setEnabled(false);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(true);
// set an alternative background color
// mChart.setBackgroundColor(Color.GRAY);
// create a custom MarkerView (extend MarkerView) and specify the layout
// to use for it
MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view);
mv.setChartView(mChart); // For bounds control
mChart.setMarker(mv); // Set the marker to the chart
XAxis xl = mChart.getXAxis();
xl.setAvoidFirstLastClipping(true);
xl.setAxisMinimum(0f);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setInverted(true);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
// add data
setData(25, 50);
// // restrain the maximum scale-out factor
// mChart.setScaleMinima(3f, 3f);
//
// // center the view to a specific position inside the chart
// mChart.centerViewPort(10, 50);
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
// modify the legend ...
l.setForm(LegendForm.LINE);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例2: 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_linechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(45);
mSeekBarY.setProgress(100);
mSeekBarY.setOnSeekBarChangeListener(this);
mSeekBarX.setOnSeekBarChangeListener(this);
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.setDrawGridBackground(false);
// no description text
mChart.setDescription("");
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
mChart.setPinchZoom(true);
// set an alternative background color
// mChart.setBackgroundColor(Color.GRAY);
// 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);
XAxis xl = mChart.getXAxis();
xl.setAvoidFirstLastClipping(true);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setInverted(true);
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setEnabled(false);
// add data
setData(25, 50);
// // restrain the maximum scale-out factor
// mChart.setScaleMinima(3f, 3f);
//
// // center the view to a specific position inside the chart
// mChart.centerViewPort(10, 50);
// get the legend (only possible after setting data)
Legend l = mChart.getLegend();
// modify the legend ...
// l.setPosition(LegendPosition.LEFT_OF_CHART);
l.setForm(LegendForm.LINE);
// dont forget to refresh the drawing
mChart.invalidate();
}
示例3: setYAxisConfig
import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
protected void setYAxisConfig(YAxis axis, ReadableMap propMap) {
if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMaxValue")) {
axis.setAxisMaxValue((float) propMap.getDouble("axisMaxValue"));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMinValue")) {
axis.setAxisMinValue((float) propMap.getDouble("axisMinValue"));
}
if (BridgeUtils.validate(propMap, ReadableType.Boolean, "inverted")) {
axis.setInverted(propMap.getBoolean("inverted"));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceTop")) {
axis.setSpaceTop((float) propMap.getDouble("spaceTop"));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBottom")) {
axis.setSpaceBottom((float) propMap.getDouble("spaceBottom"));
}
if (BridgeUtils.validate(propMap, ReadableType.Boolean, "showOnlyMinMax")) {
axis.setShowOnlyMinMax(propMap.getBoolean("showOnlyMinMax"));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "labelCount")) {
boolean labelCountForce = false;
if (BridgeUtils.validate(propMap, ReadableType.Boolean, "labelCountForce")) {
labelCountForce = propMap.getBoolean("labelCountForce");
}
axis.setLabelCount(propMap.getInt("labelCount"), labelCountForce);
}
if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
axis.setPosition(YAxis.YAxisLabelPosition.valueOf(propMap.getString("position")));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "granularity")) {
axis.setGranularity((float) propMap.getDouble("granularity"));
}
if (BridgeUtils.validate(propMap, ReadableType.Boolean, "granularityEnabled")) {
axis.setGranularityEnabled(propMap.getBoolean("granularityEnabled"));
}
// formatting
if (BridgeUtils.validate(propMap, ReadableType.String, "valueFormatter")) {
String valueFormatter = propMap.getString("valueFormatter");
if ("largeValue".equals(valueFormatter)) {
axis.setValueFormatter(new LargeValueFormatter());
} else if ("percent".equals(valueFormatter)) {
axis.setValueFormatter(new PercentFormatter());
} else {
axis.setValueFormatter(new CustomFormatter(valueFormatter));
}
}
// TODO docs says the remaining config needs to be applied before setting data. Test it
// zero line
if (BridgeUtils.validate(propMap, ReadableType.Map, "zeroLine")) {
ReadableMap zeroLineConfig = propMap.getMap("zeroLine");
if (BridgeUtils.validate(zeroLineConfig, ReadableType.Boolean, "enabled")) {
axis.setDrawZeroLine(zeroLineConfig.getBoolean("enabled"));
}
if (BridgeUtils.validate(zeroLineConfig, ReadableType.Number, "lineWidth")) {
axis.setZeroLineWidth((float) zeroLineConfig.getDouble("lineWidth"));
}
if (BridgeUtils.validate(zeroLineConfig, ReadableType.String, "lineColor")) {
axis.setZeroLineColor(Color.parseColor(zeroLineConfig.getString("lineColor")));
}
}
}