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


Java YAxis.setEnabled方法代码示例

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


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

示例1: initInValidGoNoGoGameLineChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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: setChartOptions

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setChartOptions() {
    mChart.getLegend().setEnabled(false);
    mChart.setAutoScaleMinMaxEnabled(true);
    mChart.setScaleYEnabled(false);
    mChart.setDescription(null);
    mChart.setDrawGridBackground(false);
    mChart.setDrawBorders(false);
    mChart.setHighlightPerTapEnabled(false);
    mChart.setHighlightPerDragEnabled(false);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setEnabled(false);

    IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter();
    XAxis xAxis = mChart.getXAxis();
    xAxis.setValueFormatter(xAxisFormatter);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);
}
 
开发者ID:AIDEA775,项目名称:UNCmorfi,代码行数:19,代码来源:CounterFragment.java

示例3: setupYAxis

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupYAxis()
{
    int valuesSelectedItemPos = cache.getValuesSpinner().getSelectedItemPosition();
    YAxis leftAxis = this.chart.getAxisLeft();
    leftAxis.setLabelCount(10, false);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setSpaceTop(20f);
    leftAxis.setAxisMinValue(0f);
    leftAxis.setValueFormatter(new PFAYAxisLabels(context, valuesSelectedItemPos, cache.getNumberScale()));

    if ( valuesSelectedItemPos == StatisticsQuery.QUANTITY )
    {
        leftAxis.setGranularity(1f); // interval 1
    }

    YAxis rightAxis = this.chart.getAxisRight();
    rightAxis.setEnabled(false);
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:19,代码来源:PFAChart.java

示例4: onDownloadRateSuccessful

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public void onDownloadRateSuccessful() {
    ArrayList<BarDataSet> dataSets;

    ArrayList<BarEntry> valueSet1 = new ArrayList<>();
    BarEntry v1e1 = new BarEntry(ratee.fivestar, 0); // Jan
    valueSet1.add(v1e1);
    BarEntry v1e2 = new BarEntry(ratee.fourstar, 1); // Feb
    valueSet1.add(v1e2);
    BarEntry v1e3 = new BarEntry(ratee.threestar, 2); // Mar
    valueSet1.add(v1e3);
    BarEntry v1e4 = new BarEntry(ratee.twostar, 3); // Apr
    valueSet1.add(v1e4);
    BarEntry v1e5 = new BarEntry(ratee.onestar, 4); // May
    valueSet1.add(v1e5);


    BarDataSet barDataSet1 = new BarDataSet(valueSet1, "");
    barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS);


    dataSets = new ArrayList<>();
    dataSets.add(barDataSet1);
    BarData data = new BarData(getXAxisValues(), dataSets);
    //        barDataSet1.setValueTextSize(2);
    data.setValueFormatter(new MyValueFormatter());
    chart.setData(data);
    chart.getXAxis().setEnabled(false); // hides horizontal grid lines inside chart
    YAxis leftAxis = chart.getAxisLeft();
    chart.getAxisRight().setEnabled(false); // hides horizontal grid lines with below line
    leftAxis.setEnabled(false); // hides vertical grid lines  inside chart
        /*chart.animateXY(2000, 2000);*/ // for animating reviews display
    chart.invalidate();

    chart.setDescription("");    // Hide the description

    chart.setPinchZoom(true);

    leftAxis.setDrawLabels(true);
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:40,代码来源:ProductDetailFragment.java

示例5: getFormattedLineChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * Formats a line chart in a standardized manner
 * @param c App context
 * @param chart LineChart to format
 * @param listener Listener to attach to chart
 * @param xLabels Labels to use for the x-axis
 * @param valueFormatter True if large value formatter should be used
 * @param skip Number of values to skip
 * @param legend True if show legend, false if hide legend
 * @return Formatted linechart
 */
public static LineChart getFormattedLineChart(Context c, LineChart chart, OnChartValueSelectedListener listener, List<String> xLabels, boolean valueFormatter, int skip, boolean legend) {
    Legend cLegend = chart.getLegend();
    cLegend.setEnabled(legend);

    XAxis xAxis = chart.getXAxis();
    xAxis.setGranularity(skip);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setValueFormatter(new XAxisLabelFormatter(xLabels));

    YAxis yAxisRight = chart.getAxisRight();
    yAxisRight.setEnabled(false);

    YAxis yAxisLeft = chart.getAxisLeft();
    if (valueFormatter) {
        yAxisLeft.setValueFormatter(new LargeNumberAxisFormatter(c));
    }

    if (SettingsActivity.getTheme(c) == SettingsActivity.THEME_NOIR) {
        int textColorNoir = ContextCompat.getColor(c, R.color.colorPrimaryTextNoir);
        cLegend.setTextColor(textColorNoir);
        xAxis.setTextColor(textColorNoir);
        yAxisLeft.setTextColor(textColorNoir);
    }

    chart.setDoubleTapToZoomEnabled(false);
    chart.setDescription(EMPTY_CHART_DESCRIPTION);
    chart.setDragEnabled(true);
    chart.setScaleYEnabled(false);
    chart.setDrawGridBackground(false);
    chart.setOnChartValueSelectedListener(listener);

    return chart;
}
 
开发者ID:lloydtorres,项目名称:stately,代码行数:45,代码来源:RaraHelper.java

示例6: setData

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * By calling setData initializes the rest of the view
 * @param data the chart data
 */
@Override
public void setData(LineData data) {
    super.setData(data);
    setOnChartValueSelectedListener(this);
    setDescription("");
    setNoDataTextDescription("No chart data");
    setTouchEnabled(true);
    setScaleEnabled(true);
    setDragEnabled(true);
    setDrawGridBackground(true);
    setPinchZoom(true);

    Legend legend = getLegend();
    legend.setForm(Legend.LegendForm.CIRCLE);
    legend.setWordWrapEnabled(true);

    XAxis xAxis = getXAxis();
    xAxis.setAvoidFirstLastClipping(true);
    xAxis.setPosition(XAxis.XAxisPosition.TOP);

    YAxis yAxisLeft = getAxisLeft();
    yAxisLeft.setAxisMinValue(0);

    YAxis yAxisRight = getAxisRight();
    yAxisRight.setEnabled(false);
}
 
开发者ID:nairbspace,项目名称:octoandroid,代码行数:31,代码来源:TempChart.java

示例7: setupChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupChart() {
        mChart.setBackgroundColor(BACKGROUND_COLOR);
        mChart.setDescriptionColor(DESCRIPTION_COLOR);
        configureBarLineChartDefaults(mChart);


        XAxis x = mChart.getXAxis();
        x.setDrawLabels(true);
        x.setDrawGridLines(false);
        x.setEnabled(true);
        x.setTextColor(CHART_TEXT_COLOR);
        x.setDrawLimitLinesBehindData(true);

        YAxis y = mChart.getAxisLeft();
        y.setDrawGridLines(false);
//        y.setDrawLabels(false);
        // TODO: make fixed max value optional
        y.setAxisMaxValue(1f);
        y.setAxisMinValue(0);
        y.setDrawTopYLabelEntry(false);
        y.setTextColor(CHART_TEXT_COLOR);

//        y.setLabelCount(5);
        y.setEnabled(true);

        YAxis yAxisRight = mChart.getAxisRight();
        yAxisRight.setDrawGridLines(false);
        yAxisRight.setEnabled(supportsHeartrate(getChartsHost().getDevice()));
        yAxisRight.setDrawLabels(true);
        yAxisRight.setDrawTopYLabelEntry(true);
        yAxisRight.setTextColor(CHART_TEXT_COLOR);
        yAxisRight.setAxisMaxValue(HeartRateUtils.MAX_HEART_RATE_VALUE);
        yAxisRight.setAxisMinValue(HeartRateUtils.MIN_HEART_RATE_VALUE);

        // refresh immediately instead of use refreshIfVisible(), for perceived performance
        refresh();
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:38,代码来源:ActivitySleepChartFragment.java

示例8: setupActivityChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupActivityChart() {
        mActivityChart.setBackgroundColor(BACKGROUND_COLOR);
        mActivityChart.setDescriptionColor(DESCRIPTION_COLOR);
        configureBarLineChartDefaults(mActivityChart);

        XAxis x = mActivityChart.getXAxis();
        x.setDrawLabels(true);
        x.setDrawGridLines(false);
        x.setEnabled(true);
        x.setTextColor(CHART_TEXT_COLOR);
        x.setDrawLimitLinesBehindData(true);

        YAxis y = mActivityChart.getAxisLeft();
        y.setDrawGridLines(false);
//        y.setDrawLabels(false);
        // TODO: make fixed max value optional
        y.setAxisMaxValue(1f);
        y.setAxisMinValue(0);
        y.setDrawTopYLabelEntry(false);
        y.setTextColor(CHART_TEXT_COLOR);

//        y.setLabelCount(5);
        y.setEnabled(true);

        YAxis yAxisRight = mActivityChart.getAxisRight();
        yAxisRight.setDrawGridLines(false);
        yAxisRight.setEnabled(supportsHeartrate(getChartsHost().getDevice()));
        yAxisRight.setDrawLabels(true);
        yAxisRight.setDrawTopYLabelEntry(true);
        yAxisRight.setTextColor(CHART_TEXT_COLOR);
        yAxisRight.setAxisMaxValue(HeartRateUtils.MAX_HEART_RATE_VALUE);
        yAxisRight.setAxisMinValue(HeartRateUtils.MIN_HEART_RATE_VALUE);
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:34,代码来源:SleepChartFragment.java

示例9: 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_realtime_linechart);

    mChart = (LineChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);

    // enable description text
    mChart.getDescription().setEnabled(true);

    // enable touch gestures
    mChart.setTouchEnabled(true);

    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);

    // if disabled, scaling can be done on x- and y-axis separately
    mChart.setPinchZoom(true);

    // set an alternative background color
    mChart.setBackgroundColor(Color.LTGRAY);

    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);

    // add empty data
    mChart.setData(data);

    // get the legend (only possible after setting data)
    Legend l = mChart.getLegend();

    // modify the legend ...
    l.setForm(LegendForm.LINE);
    l.setTypeface(mTfLight);
    l.setTextColor(Color.WHITE);

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(mTfLight);
    xl.setTextColor(Color.WHITE);
    xl.setDrawGridLines(false);
    xl.setAvoidFirstLastClipping(true);
    xl.setEnabled(true);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTfLight);
    leftAxis.setTextColor(Color.WHITE);
    leftAxis.setAxisMaximum(100f);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setDrawGridLines(true);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setEnabled(false);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:60,代码来源:RealtimeLineChartActivity.java

示例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_linechart_time);

    tvX = (TextView) findViewById(R.id.tvXMax);
    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarX.setProgress(100);
    tvX.setText("100");

    mSeekBarX.setOnSeekBarChangeListener(this);

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

    // no description text
    mChart.getDescription().setEnabled(false);

    // enable touch gestures
    mChart.setTouchEnabled(true);

    mChart.setDragDecelerationFrictionCoef(0.9f);

    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);
    mChart.setHighlightPerDragEnabled(true);

    // set an alternative background color
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setViewPortOffsets(0f, 0f, 0f, 0f);

    // add data
    setData(100, 30);
    mChart.invalidate();

    // get the legend (only possible after setting data)
    Legend l = mChart.getLegend();
    l.setEnabled(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.TOP_INSIDE);
    xAxis.setTypeface(mTfLight);
    xAxis.setTextSize(10f);
    xAxis.setTextColor(Color.WHITE);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawGridLines(true);
    xAxis.setTextColor(Color.rgb(255, 192, 56));
    xAxis.setCenterAxisLabels(true);
    xAxis.setGranularity(1f); // one hour
    xAxis.setValueFormatter(new IAxisValueFormatter() {

        private SimpleDateFormat mFormat = new SimpleDateFormat("dd MMM HH:mm");

        @Override
        public String getFormattedValue(float value, AxisBase axis) {

            long millis = TimeUnit.HOURS.toMillis((long) value);
            return mFormat.format(new Date(millis));
        }
    });

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    leftAxis.setTypeface(mTfLight);
    leftAxis.setTextColor(ColorTemplate.getHoloBlue());
    leftAxis.setDrawGridLines(true);
    leftAxis.setGranularityEnabled(true);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setAxisMaximum(170f);
    leftAxis.setYOffset(-9f);
    leftAxis.setTextColor(Color.rgb(255, 192, 56));

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setEnabled(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:79,代码来源:LineChartTime.java

示例11: 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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:75,代码来源:InvertedLineChartActivity.java

示例12: 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_candlechart);

        tvX = (TextView) findViewById(R.id.tvXMax);
        tvY = (TextView) findViewById(R.id.tvYMax);

        mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
        mSeekBarX.setOnSeekBarChangeListener(this);

        mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
        mSeekBarY.setOnSeekBarChangeListener(this);

        mChart = (CandleStickChart) findViewById(R.id.chart1);
        mChart.setBackgroundColor(Color.WHITE);

        mChart.getDescription().setEnabled(false);

        // if more than 60 entries are displayed in the chart, no values will be
        // drawn
        mChart.setMaxVisibleValueCount(60);

        // scaling can now only be done on x- and y-axis separately
        mChart.setPinchZoom(false);

        mChart.setDrawGridBackground(false);

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxisPosition.BOTTOM);
        xAxis.setDrawGridLines(false);

        YAxis leftAxis = mChart.getAxisLeft();  
//        leftAxis.setEnabled(false);
        leftAxis.setLabelCount(7, false);
        leftAxis.setDrawGridLines(false);
        leftAxis.setDrawAxisLine(false);
        
        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setEnabled(false);
//        rightAxis.setStartAtZero(false);

        // setting data
        mSeekBarX.setProgress(40);
        mSeekBarY.setProgress(100);
        
        mChart.getLegend().setEnabled(false);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:CandleStickChartActivity.java

示例13: setUpActivityChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setUpActivityChart() {

        Legend l = lineChart.getLegend();
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);
        l.setTextColor(Color.WHITE);
        l.setTextSize(12);
        l.setWordWrapEnabled(true);
        l.setXEntrySpace(UiUtils.dpToPx(4));
        l.setYEntrySpace(UiUtils.dpToPx(4));

        YAxis rightAxis = lineChart.getAxisRight();
        rightAxis.setEnabled(false);

        YAxis leftAxis = lineChart.getAxisLeft();
        leftAxis.setDrawGridLines(false);
        leftAxis.setAxisMinimum(0);
        leftAxis.setValueFormatter(new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return value == 0 ? "" : String.valueOf(FormatUtils.getFormattedTime(context, (int) value));
            }
        });
        leftAxis.setGranularityEnabled(true);
        leftAxis.setGranularity(3600f); // FIXME: 12-04-2017 granularity not respected
        leftAxis.setAxisLineWidth(2f);
        leftAxis.setTextColor(Color.WHITE);
        leftAxis.setAxisLineColor(Color.WHITE);

        XAxis xAxis = lineChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setDrawGridLines(false);
        xAxis.setTextColor(Color.WHITE);
        xAxis.setSpaceMin(0.5f);
        xAxis.setSpaceMax(0.5f);
        xAxis.setYOffset(UiUtils.dpToPx(4));
        xAxis.setAxisLineWidth(2f);
        xAxis.setAxisLineColor(Color.WHITE);

        lineChart.getDescription().setEnabled(false);
        lineChart.setDrawGridBackground(false);
        lineChart.setBackground(context.getResources().getDrawable(R.color.colorPrimaryDark));
        lineChart.setDragEnabled(false);
        lineChart.setScaleEnabled(false);
        lineChart.setDragDecelerationEnabled(false);
        lineChart.setPinchZoom(false);
        lineChart.setDoubleTapToZoomEnabled(false);
        lineChart.setDrawBorders(false);
        lineChart.setExtraOffsets(16, 0, 16, 0);
    }
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:53,代码来源:DashboardFragment.java

示例14: setUpActivityChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setUpActivityChart() {

        Legend l = lineChart.getLegend();
        l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
        l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
        l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
        l.setDrawInside(false);
        l.setTextColor(Color.WHITE);
        l.setTextSize(12);
        l.setWordWrapEnabled(true);
        l.setXEntrySpace(UiUtils.dpToPx(4));
        l.setYEntrySpace(UiUtils.dpToPx(4));

        YAxis rightAxis = lineChart.getAxisRight();
        rightAxis.setEnabled(false);

        YAxis leftAxis = lineChart.getAxisLeft();
        leftAxis.setDrawGridLines(false);
        leftAxis.setAxisMinimum(0);
        leftAxis.setValueFormatter(new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return value == 0 ? "" : String.valueOf(FormatUtils.getFormattedTime(context, (int) value));
            }
        });
        leftAxis.setGranularityEnabled(true);
        leftAxis.setGranularity(3600f); // FIXME: 12-04-2017 granularity not respected
        leftAxis.setAxisLineWidth(2f);
        leftAxis.setTextColor(Color.WHITE);
        leftAxis.setAxisLineColor(Color.WHITE);

        long referenceTime = new DateTime().plusDays(-7).getMillis();
        XAxis xAxis = lineChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setValueFormatter(new FormatUtils().getBarXAxisValueFormatterInstance(referenceTime));
        xAxis.setDrawGridLines(false);
        xAxis.setTextColor(Color.WHITE);
        xAxis.setSpaceMin(0.5f);
        xAxis.setSpaceMax(0.5f);
        xAxis.setYOffset(UiUtils.dpToPx(4));
        xAxis.setAxisLineWidth(2f);
        xAxis.setAxisLineColor(Color.WHITE);


        CustomMarkerView customMarkerView = new CustomMarkerView(context, R.layout.marker_view, referenceTime);
        lineChart.setMarker(customMarkerView);
        lineChart.getDescription().setEnabled(false);
        lineChart.setDrawGridBackground(false);
        lineChart.setBackground(context.getResources().getDrawable(R.color.colorPrimaryDark));
        lineChart.setDragEnabled(false);
        lineChart.setScaleEnabled(false);
        lineChart.setDragDecelerationEnabled(false);
        lineChart.setPinchZoom(false);
        lineChart.setDoubleTapToZoomEnabled(false);
        lineChart.setDrawBorders(false);
        lineChart.setExtraOffsets(16, 0, 16, 0);

        customMarkerView.setChartView(lineChart);
    }
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:60,代码来源:DashboardFragment.java

示例15: populateUserStatsChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
/**
 * Show user stats graph
 */
private void populateUserStatsChart() {
    final String[] userStatsChartXAxisLabel = getActivity().getResources().getStringArray(R.array.user_stats_x_axis_labels);
    final BarChart chart = getActivity().findViewById(R.id.user_stats_chart);
    chart.setTouchEnabled(false);
    XAxis xAxis = chart.getXAxis();
    xAxis.setGranularity(1);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setValueFormatter(new IAxisValueFormatter() {
        /**
         * Format the value
         * @param value - value to fit to the axis
         * @param axis - the axis to fit to
         * @return Returns the formatted value
         */
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            int v = (int) value;
            return userStatsChartXAxisLabel[v];
        }
    });
    xAxis.setDrawGridLines(false);
    xAxis.setTextSize(11f);
    YAxis rightAxis = chart.getAxisRight();
    rightAxis.setEnabled(false);
    chart.getAxisLeft().setGranularity(1);
    chart.getDescription().setEnabled(false);

    if (mUser != null) {
        int[] colors = getActivity().getResources().getIntArray(R.array.user_stats_chart_colors);
        List<BarEntry> entries = new ArrayList<>();
        entries.add(new BarEntry(0f, mUser.getPlantsAdded()));
        entries.add(new BarEntry(1f, mUser.getPlantsDeleted()));
        entries.add(new BarEntry(2f, mUser.getWaterCount()));
        entries.add(new BarEntry(3f, mUser.getMeasureCount()));
        entries.add(new BarEntry(4f, mUser.getPhotoCount()));

        BarDataSet barDataSet = new BarDataSet(entries, "Plant Operations");
        barDataSet.setColors(ColorTemplate.createColors(colors));
        barDataSet.setValueTextSize(11f);

        BarData data = new BarData(barDataSet);
        data.setBarWidth(0.9f); // set custom bar width
        chart.setData(data);
        chart.invalidate(); // refresh
    }
}
 
开发者ID:iskandergaba,项目名称:Botanist,代码行数:50,代码来源:AccountController.java


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