当前位置: 首页>>代码示例>>Java>>正文


Java LineChart.setTouchEnabled方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.setTouchEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setTouchEnabled方法的具体用法?Java LineChart.setTouchEnabled怎么用?Java LineChart.setTouchEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.charts.LineChart的用法示例。


在下文中一共展示了LineChart.setTouchEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initInValidGoNoGoGameLineChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initInValidGoNoGoGameLineChart(Activity activity, View view) {
    inValidGoNoGoGamesLineChart = (LineChart) view.findViewById(R.id.line_chart_invalid_gonogogames);
    inValidGoNoGoGamesLineChart.setDescription("");
    String noData = activity.getResources().getString(R.string.no_failures_to_display);
    inValidGoNoGoGamesLineChart.setNoDataText(noData);
    inValidGoNoGoGamesLineChart.setTouchEnabled(false);
    inValidGoNoGoGamesLineChart.setDragEnabled(true);
    inValidGoNoGoGamesLineChart.setScaleEnabled(true);
    inValidGoNoGoGamesLineChart.setPinchZoom(true);
    inValidGoNoGoGamesLineChart.setBackgroundColor(Color.WHITE);
    inValidGoNoGoGamesLineChart.setDrawGridBackground(false);

    YAxis leftAxis = inValidGoNoGoGamesLineChart.getAxisLeft();
    leftAxis.setAxisMinValue(0);

    YAxis righAxis = inValidGoNoGoGamesLineChart.getAxisRight();
    if (righAxis != null)
        righAxis.setEnabled(false);
}
 
开发者ID:lidox,项目名称:reaction-test,代码行数:20,代码来源:BarChartView.java

示例2: chartStyling

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void chartStyling(LineChart chart) {
    chart.setTouchEnabled(false);
    chart.setDescription("");
    chart.setAutoScaleMinMaxEnabled(false);
    chart.setNoDataTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ? Color.BLACK : Color.WHITE);
    YAxis axisRight = chart.getAxisRight();
    axisRight.setEnabled(false);
    chart.getLegend().setEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        chart.setNestedScrollingEnabled(false);
    }

    XAxis xAxis = chart.getXAxis();
    chartXAxisStyling(xAxis);
    YAxis yAxis = chart.getAxisLeft();
    chartYAxisStyling(yAxis);
}
 
开发者ID:DmitryMalkovich,项目名称:gito-github-client,代码行数:19,代码来源:TrafficFragment.java

示例3: 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;
}
 
开发者ID:Tiraza,项目名称:easy-finance,代码行数:19,代码来源:PanelChartBalance.java

示例4: onCreate

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_performance_linechart);

    mTvCount = (TextView) findViewById(R.id.tvValueCount);
    mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
    mTvCount.setText("500");

    mSeekBarValues.setProgress(500);
    
    mSeekBarValues.setOnSeekBarChangeListener(this);

    mChart = (LineChart) findViewById(R.id.chart1);
    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(false);
          
    mChart.getAxisLeft().setDrawGridLines(false);
    mChart.getAxisRight().setEnabled(false);
    mChart.getXAxis().setDrawGridLines(true);
    mChart.getXAxis().setDrawAxisLine(false);

    // dont forget to refresh the drawing
    mChart.invalidate();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:PerformanceLineChart.java

示例5: prepareChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void prepareChart(@NonNull LineChart chart) {
    chart.getDescription().setEnabled(false);
    chart.setTouchEnabled(false);
    chart.setDragEnabled(false);
    chart.setScaleEnabled(false);
    chart.setHighlightPerDragEnabled(false);
    chart.setPinchZoom(false);
    chart.setDrawGridBackground(true);
    chart.getLegend().setEnabled(false);
    chart.getAxisRight().setEnabled(false);
    chart.getAxisLeft().setEnabled(false);
    chart.getXAxis().setEnabled(false);
    chart.setViewPortOffsets(0, 0, 0, 0);
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:15,代码来源:TrainedModelViewBinder.java

示例6: initChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initChart(@NonNull LineChart chart) {
    chart.getDescription().setEnabled(false);
    chart.setTouchEnabled(false);
    chart.setDragEnabled(false);
    chart.setScaleEnabled(false);
    chart.setHighlightPerDragEnabled(false);
    chart.setPinchZoom(false);
    chart.setDrawGridBackground(false);
    chart.getLegend().setEnabled(false);
    chart.getAxisRight().setEnabled(false);
    chart.getXAxis().setEnabled(false);
    chart.getAxisLeft().setEnabled(false);
    chart.getXAxis().setEnabled(false);
    chart.setViewPortOffsets(0, 0, 0, 0);
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:16,代码来源:PlayActivity.java

示例7: initHeartRateChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initHeartRateChart(LineChart mChart) {
    mChart.setViewPortOffsets(0, 0, 0, 0);
    mChart.setBackgroundColor(getResources().getColor(R.color.gold_pressed));
    mChart.setDescription("Heart Rate");
    mChart.setTouchEnabled(true);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setMaxHighlightDistance(300);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    xAxis.setTextSize(11f);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);

    YAxis y = mChart.getAxisLeft();
    y.setTypeface(BandApplication.INSTANCE.getTfLight());
    y.setLabelCount(6, false);
    y.setTextColor(Color.RED);
    y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    y.setDrawGridLines(false);
    y.setAxisLineColor(Color.WHITE);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    y.setLabelCount(6, false);
    y.setTextColor(Color.RED);
    y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    y.setDrawGridLines(false);
    y.setAxisLineColor(Color.WHITE);

    mChart.getLegend().setEnabled(false);
    mChart.animateXY(2000, 2000);
}
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:38,代码来源:HeartRateFragment.java

示例8: initResistanceChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initResistanceChart(LineChart mChart) {
    //        mChart.setOnChartValueSelectedListener(this);
    mChart.setDescription("Skin Resistance");
    mChart.setNoDataTextDescription("You need to provide data for the chart.");
    mChart.setTouchEnabled(true);
    mChart.setDragDecelerationFrictionCoef(0.9f);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);
    mChart.setHighlightPerDragEnabled(true);
    mChart.setPinchZoom(true);
    mChart.setBackgroundColor(getResources().getColor(R.color.green_pressed));
    mChart.animateX(2500);

    Legend l = mChart.getLegend();
    l.setForm(Legend.LegendForm.LINE);
    l.setTypeface(BandApplication.INSTANCE.getTfLight());
    l.setTextSize(11f);
    l.setTextColor(Color.WHITE);
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);

    mChart.getXAxis().setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    leftAxis.setTextColor(Color.RED);
    leftAxis.setDrawGridLines(true);
    leftAxis.setGranularityEnabled(true);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    rightAxis.setTextColor(Color.RED);
    rightAxis.setDrawGridLines(false);
    rightAxis.setDrawZeroLine(false);
    rightAxis.setGranularityEnabled(false);
}
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:37,代码来源:HeartRateFragment.java

示例9: ChartViewHolder

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
public ChartViewHolder(View itemView) {
    super(itemView);
    mChart = (LineChart) itemView.findViewById(R.id.chart);
    mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
    mChart.getAxisRight().setEnabled(false);
    mChart.setTouchEnabled(false);
    mChart.setDoubleTapToZoomEnabled(false);
    mChart.setPinchZoom(false);
    mChart.setDescription("");
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-pedometer,代码行数:11,代码来源:ReportAdapter.java

示例10: onCreate

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_performance_linechart);

    mTvCount = (TextView) findViewById(R.id.tvValueCount);
    mSeekBarValues = (SeekBar) findViewById(R.id.seekbarValues);
    mTvCount.setText("500");

    mSeekBarValues.setProgress(500);
    
    mSeekBarValues.setOnSeekBarChangeListener(this);

    mChart = (LineChart) findViewById(R.id.chart1);
    mChart.setDrawGridBackground(false);

    // no description text
    mChart.setDescription("");
    mChart.setNoDataTextDescription("You need to provide data for the chart.");

    // 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(false);
          
    mChart.getAxisLeft().setDrawGridLines(false);
    mChart.getAxisRight().setEnabled(false);
    mChart.getXAxis().setDrawGridLines(true);
    mChart.getXAxis().setDrawAxisLine(false);

    // dont forget to refresh the drawing
    mChart.invalidate();
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:41,代码来源:PerformanceLineChart.java

示例11: configureWeatherChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的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;
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:48,代码来源:RecordingFragment.java

示例12: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
 * Setup chart (axis, grid, etc.).
 *
 * @param lineChart      chart to setup.
 * @param data           chart with the data.
 * @param firstTimestamp seconds timestamp of the first record (used as initial reference).
 */
private void setupChart(LineChart lineChart, LineData data, long firstTimestamp) {
    // General setup
    lineChart.setDrawGridBackground(false);
    lineChart.setDrawBorders(false);
    lineChart.setViewPortOffsets(50, 0, 50, 50);
    lineChart.getDescription().setEnabled(false);
    lineChart.getLegend().setEnabled(false);
    lineChart.setTouchEnabled(false);
    lineChart.setNoDataText(context.getString(R.string.no_flight_act_data_available));
    // X axis setup
    IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter(firstTimestamp);
    XAxis xAxis = lineChart.getXAxis();
    xAxis.setValueFormatter(xAxisFormatter);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setCenterAxisLabels(false);
    xAxis.setTextColor(ContextCompat.getColor(context, R.color.colorIcons));
    // Y axis setup
    YAxis yAxis = lineChart.getAxisLeft();
    yAxis.setAxisMaximum(40);
    yAxis.setAxisMinimum(0);
    yAxis.setDrawLabels(false);
    yAxis.setDrawAxisLine(false);
    yAxis.setDrawGridLines(true);
    lineChart.getAxisRight().setEnabled(false);
    // Add data
    lineChart.setData(data);
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:37,代码来源:RecordingsAdapter.java

示例13: setupAltitudeChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupAltitudeChart(){
    TextView textAltitude = new TextView(this);
    textAltitude.setText("Altitude:");
    textAltitude.setTextColor(getResources().getColor(R.color.hike_blue_grey));
    mAltitudeChartContainer.addView(textAltitude);

    if(mCoordinatesList!=null) {
        int listSize = mCoordinatesList.size();
        if (listSize > 0) {
            mAltitudeChart = new LineChart(this);
            List<Entry> entries = new ArrayList<>(listSize);

            for (int i = 0; i < listSize; i++) {
                entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
            }
            LineDataSet altitudePoints = new LineDataSet(entries, "Altitude during Hike");

            mAltitudeChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
            mAltitudeChart.setDescription("");
            mAltitudeChart.animateX(3500);
            mAltitudeChart.getAxisLeft().setEnabled(false);
            mAltitudeChart.setTouchEnabled(false);
            mAltitudeChart.setLayoutParams(new LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            mAltitudeChart.setMinimumHeight(ALTITUDE_CHART_HEIGHT);
            mAltitudeChartContainer.addView(mAltitudeChart);
            mAltitudeChartContainer.setMinimumHeight(ALTITUDE_CHART_HEIGHT);

            return;
        }
    }

    //Else...
    TextView noAltitude = new TextView(this);
    noAltitude.setText("No Altitude Height to Show");
    mAltitudeChartContainer.addView(noAltitude);

}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:40,代码来源:ResultsActivity.java

示例14: setupInstPaceChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupInstPaceChart(){
    TextView textInstPace = new TextView(this);
    textInstPace.setText("Pace:");
    textInstPace.setTextColor(getResources().getColor(R.color.hike_blue_grey));
    mInstPaceChartContainer.addView(textInstPace);

    if(mCoordinatesList!=null) {
        int listSize = mCoordinatesList.size();
        if (listSize > 0) {
            mInstPaceChart = new LineChart(this);
            List<Entry> entries = new ArrayList<>(listSize);

            for (int i = 0; i < listSize; i++) {
                //TODO change logic to get the instant pace instead of altidude
                entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
            }
            LineDataSet altitudePoints = new LineDataSet(entries, "Pace during Hike");

            mInstPaceChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
            mInstPaceChart.setDescription("");
            mInstPaceChart.animateX(3500);
            mInstPaceChart.getAxisLeft().setEnabled(false);
            mInstPaceChart.setTouchEnabled(false);

            mInstPaceChart.setLayoutParams(new LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            mInstPaceChart.setMinimumHeight(INST_PACE_CHART_HEIGHT);
            mInstPaceChartContainer.addView(mInstPaceChart);
            mInstPaceChartContainer.setMinimumHeight(INST_PACE_CHART_HEIGHT);

            return;
        }

        //Else...
        TextView noInstaPace = new TextView(this);
        noInstaPace.setText("No Pace to Show");
        mAltitudeChartContainer.addView(noInstaPace);
    }
}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:41,代码来源:ResultsActivity.java

示例15: onCreateView

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View V = inflater.inflate(R.layout.tide_fragment, container, false);

    // Setup the tide chart
    LineChart tideChart = (LineChart) V.findViewById(R.id.tide_chart);
    tideChart.setDrawBorders(false);
    tideChart.setDescription("");
    tideChart.setPinchZoom(false);
    tideChart.setDoubleTapToZoomEnabled(false);
    tideChart.setDrawMarkerViews(false);
    tideChart.setTouchEnabled(false);
    tideChart.setViewPortOffsets(0f, 0f, 0f, 0f);

    // X Axis
    XAxis xAxis = tideChart.getXAxis();
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawLabels(false);

    // Y Axis
    YAxis leftYAxis = tideChart.getAxisLeft();
    YAxis rightYAxis = tideChart.getAxisRight();
    leftYAxis.setDrawGridLines(false);
    rightYAxis.setDrawGridLines(false);
    leftYAxis.setDrawAxisLine(false);
    rightYAxis.setDrawAxisLine(false);
    leftYAxis.setDrawLabels(false);
    rightYAxis.setDrawLabels(false);
    leftYAxis.setDrawZeroLine(false);
    rightYAxis.setDrawZeroLine(false);

    // Legend
    tideChart.getLegend().setEnabled(false);

    return V;
}
 
开发者ID:mpiannucci,项目名称:HackWinds-Android,代码行数:39,代码来源:TideFragment.java


注:本文中的com.github.mikephil.charting.charts.LineChart.setTouchEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。