Java Code Examples for com.github.mikephil.charting.components.XAxis#setLabelsToSkip()

The following examples show how to use com.github.mikephil.charting.components.XAxis#setLabelsToSkip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartBaseManager.java    From react-native-mp-android-chart with MIT License 6 votes vote down vote up
/**
 * xAxis config details: https://github.com/PhilJay/MPAndroidChart/wiki/XAxis
 */
@ReactProp(name = "xAxis")
public void setXAxis(Chart chart, ReadableMap propMap) {
    XAxis axis = chart.getXAxis();

    setCommonAxisConfig(chart, axis, propMap);

    if (BridgeUtils.validate(propMap, ReadableType.Number, "labelsToSkip")) {
        axis.setLabelsToSkip(propMap.getInt("labelsToSkip"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "avoidFirstLastClipping")) {
        axis.setAvoidFirstLastClipping(propMap.getBoolean("avoidFirstLastClipping"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBetweenLabels")) {
        axis.setSpaceBetweenLabels(propMap.getInt("spaceBetweenLabels"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
        axis.setPosition(XAxisPosition.valueOf(propMap.getString("position")));
    }
}
 
Example 2
Source File: ScrollViewActivity.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_scrollview);

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

    mChart.setDescription("");

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

    mChart.setDrawBarShadow(false);
    mChart.setDrawGridBackground(false);

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

    mChart.getAxisLeft().setDrawGridLines(false);
    
    mChart.getLegend().setEnabled(false);

    setData(10);
}
 
Example 3
Source File: CalibrationLinearityActivity.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
private void initBar() {
    BarChart barChart = getBarChart();
    if(barChart == null) {
        return;
    }
    barChart.setDescription("");

    barChart.setDrawGridBackground(false);

    barChart.setMaxVisibleValueCount(200);

    Legend l = barChart.getLegend();
    l.setPosition(Legend.LegendPosition.ABOVE_CHART_LEFT);
    l.setTextColor(Color.WHITE);

    YAxis yl = barChart.getAxisLeft();
    yl.setTextColor(Color.WHITE);
    yl.setGridColor(Color.WHITE);
    barChart.getAxisRight().setEnabled(false);

    XAxis xl = barChart.getXAxis();
    xl.setDrawGridLines(false);
    xl.setTextColor(Color.WHITE);
    xl.setGridColor(Color.WHITE);
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setDrawAxisLine(true);
    xl.setLabelRotationAngle(-90);
    xl.setDrawLabels(true);
    xl.setLabelsToSkip(0);
}
 
Example 4
Source File: CalibrationLinearityActivity.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
private void initLine() {
    LineChart lineChart = getLineChart();
    if(lineChart == null) {
        return;
    }
    lineChart.setDescription("");

    lineChart.setDrawGridBackground(false);

    // enable scaling and dragging

    Legend l = lineChart.getLegend();
    l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
    l.setTextColor(Color.WHITE);

    YAxis yl = lineChart.getAxisLeft();
    yl.setTextColor(Color.WHITE);
    yl.setGridColor(Color.WHITE);
    lineChart.getAxisRight().setEnabled(false);

    XAxis xl = lineChart.getXAxis();
    xl.setDrawGridLines(false);
    xl.setTextColor(Color.WHITE);
    xl.setGridColor(Color.WHITE);
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setDrawAxisLine(true);
    xl.setLabelRotationAngle(-90);
    xl.setDrawLabels(true);
    xl.setLabelsToSkip(0);
}
 
Example 5
Source File: Results.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
public void initSpectrumChart(){
    sChart.setPinchZoom(false);
    sChart.setDoubleTapToZoomEnabled(false);
    sChart.setDrawBarShadow(false);
    sChart.setDescription("");
    sChart.setPinchZoom(false);
    sChart.setDrawGridBackground(false);
    sChart.setHighlightPerTapEnabled(true);
    sChart.setHighlightPerDragEnabled(false);
    sChart.setDrawHighlightArrow(true);
    sChart.setDrawValueAboveBar(true);
    // XAxis parameters: hide all
    XAxis xls = sChart.getXAxis();
    xls.setPosition(XAxisPosition.BOTTOM);
    xls.setDrawAxisLine(true);
    xls.setDrawGridLines(false);
    xls.setLabelRotationAngle(-90);
    xls.setDrawLabels(true);
    xls.setTextColor(Color.WHITE);
    xls.setLabelsToSkip(0);
    // YAxis parameters (left): main axis for dB values representation
    YAxis yls = sChart.getAxisLeft();
    yls.setDrawAxisLine(true);
    yls.setDrawGridLines(true);
    yls.setAxisMaxValue(110.f);
    yls.setStartAtZero(true);
    yls.setTextColor(Color.WHITE);
    yls.setGridColor(Color.WHITE);
    // YAxis parameters (right): no axis, hide all
    YAxis yrs = sChart.getAxisRight();
    yrs.setEnabled(false);
    //return true;
}
 
Example 6
Source File: LineChartCard.java    From ResearchStack with Apache License 2.0 4 votes vote down vote up
private void initializeViews() {
    titleTextView = (TextView) findViewById(R.id.view_chart_line_title);
    titleTextView.setText(titleText);
    titleTextView.setTextColor(titleTextColor);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));

    expand = (ImageView) findViewById(R.id.view_chart_line_expand);
    if (expandTintColor != 0) {
        Drawable drawable = expand.getDrawable();
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable, expandTintColor);
        expand.setImageDrawable(drawable);
    }

    chart = (LineChart) findViewById(R.id.view_chart_line);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");
    chart.setDrawBorders(false);
    chart.setDrawGridBackground(false);
    chart.setPinchZoom(false);
    chart.setTouchEnabled(true);
    chart.setDragEnabled(true);
    chart.setExtraLeftOffset(0);
    chart.setExtraBottomOffset(8);
    chart.setExtraTopOffset(0);

    XAxis xAxis = chart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawGridLines(false);
    xAxis.setLabelsToSkip(0);
    xAxis.setXOffset(16);
    xAxis.setTextSize(chartXAxisTextSize);
    xAxis.setTextColor(chartXAxisTextColor);
    xAxis.setTypeface(Typeface.create(chartXAxisTextTypeface, Typeface.NORMAL));

    YAxis yAxisLeft = chart.getAxisLeft();
    yAxisLeft.setDrawAxisLine(false);
    yAxisLeft.setDrawGridLines(false);
    yAxisLeft.setDrawZeroLine(false);
    yAxisLeft.setDrawLabels(true);
    yAxisLeft.setShowOnlyMinMax(true);
    yAxisLeft.setXOffset(16);
    yAxisLeft.setTextSize(chartYAxisTextSize);
    yAxisLeft.setTextColor(chartYAxisTextColor);
    yAxisLeft.setTypeface(Typeface.create(chartYAxisTextTypeface, Typeface.NORMAL));

    YAxis yAxisRight = chart.getAxisRight();
    yAxisRight.setDrawAxisLine(false);
    yAxisRight.setDrawGridLines(false);
    yAxisRight.setDrawZeroLine(false);
    yAxisRight.setDrawLabels(false);
    yAxisRight.setSpaceTop(0);
}
 
Example 7
Source File: BarChartCard.java    From ResearchStack with Apache License 2.0 4 votes vote down vote up
private void initializeViews() {
    titleTextView = (TextView) findViewById(R.id.view_chart_bar_title);
    titleTextView.setText(titleText);
    titleTextView.setTextColor(titleTextColor);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));

    expand = (ImageView) findViewById(R.id.view_chart_line_expand);
    if (expandTintColor != 0) {
        Drawable drawable = expand.getDrawable();
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable, expandTintColor);
        expand.setImageDrawable(drawable);
    }

    chart = (BarChart) findViewById(R.id.view_chart_bar);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");
    chart.setDrawBorders(false);
    chart.setDrawValueAboveBar(false);
    chart.setDrawGridBackground(false);
    chart.setDrawBarShadow(false);
    chart.setDrawHighlightArrow(false);
    chart.setPinchZoom(false);
    chart.setExtraLeftOffset(0);
    chart.setExtraRightOffset(0);
    chart.setExtraBottomOffset(8);
    chart.setExtraTopOffset(0);
    chart.setTouchEnabled(true);
    chart.setDragEnabled(true);

    XAxis xAxis = chart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawAxisLine(false);
    xAxis.setYOffset(16);
    xAxis.setDrawGridLines(false);
    xAxis.setLabelsToSkip(0);
    xAxis.setTextSize(chartXAxisTextSize);
    xAxis.setTextColor(chartXAxisTextColor);
    xAxis.setTypeface(Typeface.create(chartXAxisTextTypeface, Typeface.NORMAL));

    YAxis yAxisLeft = chart.getAxisLeft();
    yAxisLeft.setDrawAxisLine(false);
    yAxisLeft.setDrawGridLines(false);
    yAxisLeft.setDrawZeroLine(false);
    yAxisLeft.setDrawLabels(false);

    YAxis yAxisRight = chart.getAxisRight();
    yAxisRight.setDrawAxisLine(false);
    yAxisRight.setDrawGridLines(false);
    yAxisRight.setDrawZeroLine(false);
    yAxisRight.setDrawLabels(false);
}