本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setHighlightEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setHighlightEnabled方法的具体用法?Java LineChart.setHighlightEnabled怎么用?Java LineChart.setHighlightEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.LineChart
的用法示例。
在下文中一共展示了LineChart.setHighlightEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
this.fragmentManager = fragmentManager;
LineChart chart = new LineChart(context);
chart.setDescription(getDescription(context));
chart.setHighlightEnabled(true);
chart.setTouchEnabled(true);
chart.setDragDecelerationFrictionCoef(0.9f);
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
chart.setDrawGridBackground(false);
chart.setHighlightPerDragEnabled(true);
chart.setPinchZoom(true);
chart.animateX(2500);
chart.animateY(2500);
viewGroup.addView(chart);
return chart;
}
示例2: onCreateView
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View rootView = inflater.inflate(R.layout.fragment_analysis, container, false);
chart = (LineChart) rootView.findViewById(R.id.chart);
chart.setDragEnabled(true);
chart.setScaleXEnabled(true);
chart.setScaleYEnabled(false);
chart.setPinchZoom(true);
chart.setHighlightEnabled(true);
chart.setHighlightIndicatorEnabled(true);
chart.animateXY(3000, 3000);
return rootView;
}
示例3: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_line_chart);
String uriSegment = getIntent().getData().getLastPathSegment();
mWorkoutId = Long.valueOf(uriSegment);
Log.i(TAG, "Getting chart data, Workout ID=" + mWorkoutId);
LineData data = getChartData(mWorkoutId);
if (null != data) {
Log.i(TAG, "Displaying chart data, Workout ID=" + mWorkoutId);
mChart = (LineChart) findViewById(R.id.line_chart);
mChart.setDrawGridBackground(false);
// set an alternative background color
// mChart.setBackgroundColor(Color.GRAY);
// no description
mChart.setDescription("");
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
// enable scaling, dragging and pinch-zooming
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(true);
// set data
mChart.setData(data);
} else {
Log.i(TAG, "No chart data exists, Workout ID=" + mWorkoutId);
Toast.makeText(this, R.string.msg_no_log, Toast.LENGTH_SHORT).show();
finish();
return;
}
}
示例4: onCreate
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_line_graph);
if (savedInstanceState != null) {
mLogSession = LogSession.fromJson(savedInstanceState.getString(ARG_SESSION_ID));
mPort = savedInstanceState.getInt(ARG_PORT, 0);
mIpAddress = savedInstanceState.getString(ARG_IP_ADDRESS);
mDateFormat = savedInstanceState.getString(ARG_DATEFORMAT);
} else {
mLogSession = LogSession.fromJson(getIntent().getStringExtra(ARG_SESSION_ID));
mPort = getIntent().getIntExtra(ARG_PORT, 0);
mIpAddress = getIntent().getStringExtra(ARG_IP_ADDRESS);
mDateFormat = getIntent().getStringExtra(ARG_DATEFORMAT);
}
mRequestQueue = Volley.newRequestQueue(this);
mGetTemperatureEntryListReq = new GetTemperatureEntryListReq(mRequestQueue, this);
setTitle(mLogSession.getName());
mChart = (LineChart) findViewById(R.id.chart);
// no description text
mChart.setDescription("");
mChart.setNoDataTextDescription("You need to provide data for the chart.");
// enable value highlighting
mChart.setHighlightEnabled(true);
// 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);
// enable/disable highlight indicators (the lines that indicate the
// highlighted Entry)
mChart.setHighlightIndicatorEnabled(false);
}
示例5: initStatChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initStatChart() {
mChart = (LineChart) findViewById(R.id.chart1);
mChart.setStartAtZero(true);
// disable the drawing of values into the chart
mChart.setDrawYValues(false);
mChart.setDrawXLabels(false);
mChart.setDrawBorder(false);
mChart.setBorderPositions(new BarLineChartBase.BorderPosition[] {
BarLineChartBase.BorderPosition.BOTTOM
});
// no description text
mChart.setNoDataText(getResources().getString(R.string.no_game_data_title));
mChart.setNoDataTextDescription(getResources().getString(R.string.no_game_data_title_desc));
// enable value highlighting
mChart.setHighlightEnabled(true);
// enable touch gestures
mChart.setTouchEnabled(true);
mChart.setDescription("");
// enable scaling and dragging
mChart.setDragEnabled(true);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(true);
mChart.setHighlightIndicatorEnabled(false);
mStatManager = new GameStatManager(getBaseContext());
mChart.animateX(500);
mChart.setBackgroundColor(Color.WHITE);
mChart.setValueTextColor(mColor);
mChart.setDrawLegend(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawGridBackground(false);
mChart.setGridColor(Color.BLACK & 0x2FFFFFFF);
mChart.setGridWidth(5f);
mChart.setBorderColor(mColor);
YLabels y = mChart.getYLabels();
y.setTextColor(mColor);
y.setLabelCount(4);
}
示例6: addChart
import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private LineChart addChart (String label, LineData data)
{
LineChart chart = new LineChart(this);
//chart.setOnChartGestureListener(this);
//chart.setOnChartValueSelectedListener(this);
chart.getAxisLeft().setStartAtZero(false);
// no description text
chart.setDescription("");
chart.setNoDataTextDescription("");
// enable value highlighting
chart.setHighlightEnabled(true);
// enable touch gestures
chart.setTouchEnabled(true);
// enable scaling and dragging
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
// chart.setScaleXEnabled(true);
// chart.setScaleYEnabled(true);
// if disabled, scaling can be done on x- and y-axis separately
chart.setPinchZoom(true);
// set data
chart.setData(data);
TextView tv = new TextView (this);
tv.setText(label);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
viewChartGroup.addView(tv,params);
int dpHeight = 300;
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpHeight, getResources().getDisplayMetrics());
params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, height);
int dpMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, getResources().getDisplayMetrics());
params.setMargins(dpMargin,dpMargin,dpMargin,dpMargin);
chart.setLayoutParams(params);
viewChartGroup.addView(chart,params);
return chart;
}