com.github.mikephil.charting.charts.BarChart Java Examples

The following examples show how to use com.github.mikephil.charting.charts.BarChart. 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: MainActivity.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    simpleTrialButton = (Button) findViewById(R.id.simple);
    complexTrialButton = (Button) findViewById(R.id.complex);
    resultsLabel = (TextView) findViewById(R.id.resultsLabel);
    resultsContainer = (ScrollView) findViewById(R.id.resultsContainer);
    resultsTextView = (TextView) findViewById(R.id.results);
    progressBar = (ProgressBar) findViewById(R.id.progress);
    progressBar.setIndeterminate(true);
    chartView = (BarChart) findViewById(R.id.chart);

    if (savedInstanceState != null) {
        runningTests = savedInstanceState.getBoolean(STATE_RUNNING_TESTS);
        runningTestName = savedInstanceState.getString(STATE_TEST_NAME);
        chartEntrySets = (LinkedHashMap<String, ArrayList<BarEntry>>) savedInstanceState.getSerializable(STATE_MAPDATA);

        setBusyUI(runningTests, runningTestName);
        if (!runningTests && (chartEntrySets.size() > 0)) {
            // graph existing data
            initChart();
        }
    }
}
 
Example #2
Source File: StatisticsCache.java    From privacy-friendly-shopping-list with Apache License 2.0 6 votes vote down vote up
public StatisticsCache(AppCompatActivity activity)
{
    this.activity = activity;

    titleTextView = (TextView) activity.findViewById(R.id.textview_stats_title);
    chart = (BarChart) activity.findViewById(R.id.chart);
    totalTextView = (TextView) activity.findViewById(R.id.textview_stats_total);

    unitsTextView = (TextView) activity.findViewById(R.id.textview_stats_currency);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String defaultCurrency = activity.getResources().getString(R.string.currency);
    currency = prefs.getString(SettingsKeys.CURRENCY, defaultCurrency);
    unitsTextView.setText(currency);

    rangeFromTextView = (TextView) activity.findViewById(R.id.textview_stats_range_from);
    rangeToTextView = (TextView) activity.findViewById(R.id.textview_stats_range_to);
    groupBySpinner = (Spinner) activity.findViewById(R.id.spinner_stats_group_by);
    valuesSpinner = (Spinner) activity.findViewById(R.id.spinner_stats_values);

    datePattern = activity.getResources().getString(R.string.date_short_pattern);
    dateLanguage = activity.getResources().getString(R.string.language);
    numberFormat = activity.getResources().getString(R.string.number_format_2_decimals);
}
 
Example #3
Source File: RealmWikiExample.java    From Stayfit with Apache License 2.0 6 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_realm_wiki);

    lineChart = (LineChart) findViewById(R.id.lineChart);
    barChart = (BarChart) findViewById(R.id.barChart);
    setup(lineChart);
    setup(barChart);

    lineChart.setExtraBottomOffset(5f);
    barChart.setExtraBottomOffset(5f);

    lineChart.getAxisLeft().setDrawGridLines(false);
    lineChart.getXAxis().setDrawGridLines(false);
    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getXAxis().setDrawGridLines(false);
}
 
Example #4
Source File: ChartActivity.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chart);
    BarChart chart = (BarChart) findViewById(R.id.chart);

    BarData data = new BarData();
    chart.setData(data);
    chart.setDescription("My Chart");
    chart.animateXY(2000, 2000);
    chart.invalidate();
}
 
Example #5
Source File: StatisticsFragment.java    From Expense-Tracker-App with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_statistics, container, false);
    pcCategories = (PieChart) rootView.findViewById(R.id.pc_categories);
    bcCategories = (BarChart) rootView.findViewById(R.id.bc_categories);
    tvPcCategoriesEmpty = (TextView)rootView.findViewById(R.id.tv_bar_chart_category_empty);
    tvBcCategoriesEmpty = (TextView)rootView.findViewById(R.id.tv_pie_categories_chart_empty);
    selectDateFragment = (SelectDateFragment)getChildFragmentManager().findFragmentById(R.id.select_date_fragment);
    selectDateFragment.setSelectDateFragment(this);
    return rootView;
}
 
Example #6
Source File: ExpenseDetailFragment.java    From Expense-Tracker-App with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = onCreateFragmentView(R.layout.fragment_expense_detail, inflater, container, true);
    bcWeekExpenses = (BarChart) rootView.findViewById(R.id.bc_expenses);
    return rootView;
}
 
Example #7
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 #8
Source File: CalibrationLinearityActivity.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
private BarChart getBarChart() {
    View view = ((ViewPagerAdapter)viewPager.getAdapter()).getItem(PAGE_BAR_CHART).getView();
    if(view != null) {
        return (BarChart) view.findViewById(R.id.autoCalibrationBarChart);
    } else {
        return null;
    }
}
 
Example #9
Source File: MeasurementActivity.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
private void updateSpectrumGUI() {


        ArrayList<String> xVals = new ArrayList<String>();
        ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
        double[] freqLabels = measurementService.getAudioProcess().getRealtimeCenterFrequency();
        float[] freqValues = measurementService.getAudioProcess().getThirdOctaveFrequencySPL();
        for(int idfreq =0; idfreq < freqLabels.length; idfreq++) {
            xVals.add(Spectrogram.formatFrequency((int)freqLabels[idfreq]));
            // Sum values
            // Compute frequency range covered by frequency
            yVals1.add(new BarEntry(new float[] {freqValues[idfreq]}, idfreq));
        }

        BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
        set1.setColor(Color.rgb(102, 178, 255));
        set1.setStackLabels(new String[]{
                "SL"
        });

        ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
        dataSets.add(set1);

        BarData data = new BarData(xVals, dataSets);
        data.setValueTextSize(10f);

        BarChart sChart = getSpectrum();
        if(sChart != null){
            sChart.setData(data);
            sChart.setPadding(0, 0, 0, 0);
            sChart.setViewPortOffsets(0,0,0,0);
            sChart.invalidate(); // refresh
        }
    }
 
Example #10
Source File: MeasurementActivity.java    From NoiseCapture with GNU General Public License v3.0 5 votes vote down vote up
private BarChart getSpectrum() {
    View view = ((ViewPagerAdapter)viewPager.getAdapter()).getItem(PAGE_SPECTRUM).getView();
    if(view != null) {
        return (BarChart) view.findViewById(R.id.spectrumChart);
    } else {
        return null;
    }
}
 
Example #11
Source File: DailyBarChart.java    From AndroidApp with GNU Affero General Public License v3.0 5 votes vote down vote up
public DailyBarChart(BarChart barChart, Context context) {
    this.barChart = barChart;
    this.context = context;

    chartLabels = new ArrayList<>();
    chartValues = new ArrayList<>();

    setFormatting();

    barData = createDataSet();
}
 
Example #12
Source File: ActivitiesChartActivity.java    From Mi-Band with GNU General Public License v2.0 5 votes vote down vote up
private void createGraph() {
    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);
}
 
Example #13
Source File: BarGraph.java    From fastnfitness with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public BarGraph(Context context, BarChart chart, String name) {
    mChart = chart;
    mChartName = name;
    mChart.setHorizontalScrollBarEnabled(true);
    mChart.setVerticalScrollBarEnabled(true);
    mChart.setDrawBorders(true);
    mChart.setNoDataText(context.getString(R.string.no_chart_data_available));

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

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTextColor(ColorTemplate.getHoloBlue());
    xAxis.setDrawAxisLine(false);
    xAxis.setGranularityEnabled(true);
    xAxis.setGranularity(1f);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setAxisMinimum(0f);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
    leftAxis.setTextColor(ColorTemplate.getHoloBlue());
    leftAxis.setGranularityEnabled(true);
    leftAxis.setGranularity((float) 1);

    mChart.setFitBars(true);
    leftAxis.setAxisMinimum(0f);

    mChart.getAxisRight().setEnabled(false);
}
 
Example #14
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 #15
Source File: RealmDatabaseActivityBar.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_barchart_noseekbar);

    mChart = (BarChart) findViewById(R.id.chart1);
    setup(mChart);
}
 
Example #16
Source File: BarChartFrag.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
    
    // create a new chart object
    mChart = new BarChart(getActivity());
    mChart.setDescription("");
    mChart.setOnChartGestureListener(this);
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);

    mChart.setMarkerView(mv);

    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    mChart.setData(generateBarData(1, 20000, 12));
    
    Legend l = mChart.getLegend();
    l.setTypeface(tf);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    mChart.getAxisRight().setEnabled(false);
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);
    
    // programatically add the chart
    FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
    parent.addView(mChart);
    
    return v;
}
 
Example #17
Source File: FreeHandView.java    From Machine-Learning-Projects-for-Mobile-Applications with MIT License 5 votes vote down vote up
public void init(DisplayMetrics metrics, Classifier classifier, BarChart barChart) {
    int height = 1000;
    int width = 1000;

    mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    mCanvas = new Canvas(mBitmap);

    currentColor = DEFAULT_COLOR;
    strokeWidth = BRUSH_SIZE;
    mClassifier = classifier;
    this.predictionBar = predictionBar;
    this.barChart = barChart;
    addValuesToBarEntryLabels();
}
 
Example #18
Source File: TestSuiteFragment.java    From SQLite-Performance with The Unlicense 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.suite_fragment, container, false);

    mChart = (BarChart) v.findViewById(R.id.chart);
    mChart.setNoDataText(null);
    mChart.setNoDataTextColor(0xFF000000);
    mChart.setFitBars(true);

    return v;
}
 
Example #19
Source File: TestCaseRunner.java    From SQLite-Performance with The Unlicense 5 votes vote down vote up
TestCaseRunner(int iterations, BarChart chart, String title, int color, IValueFormatter valueFormatter) {
    mIterations = iterations;
    mChart = chart;
    mEntries = new LinkedList<>();
    mDataSet = new BarDataSet(mEntries, title);
    mDataSet.setValueFormatter(valueFormatter);
    mDataSet.setColor(color);
}
 
Example #20
Source File: BarChartFrag.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_bar, container, false);

    // create a new chart object
    chart = new BarChart(getActivity());
    chart.getDescription().setEnabled(false);
    chart.setOnChartGestureListener(this);

    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(chart); // For bounds control
    chart.setMarker(mv);

    chart.setDrawGridBackground(false);
    chart.setDrawBarShadow(false);

    Typeface tf = Typeface.createFromAsset(context.getAssets(), "OpenSans-Light.ttf");

    chart.setData(generateBarData(1, 20000, 12));

    Legend l = chart.getLegend();
    l.setTypeface(tf);

    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    chart.getAxisRight().setEnabled(false);

    XAxis xAxis = chart.getXAxis();
    xAxis.setEnabled(false);

    // programmatically add the chart
    FrameLayout parent = v.findViewById(R.id.parentLayout);
    parent.addView(chart);

    return v;
}
 
Example #21
Source File: BarChartHelper.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
public BarChart generateBarChartConfig(BarChart barChart) {
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); //定制X轴是在图表上方还是下方。
    xAxis.setDrawAxisLine(true);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);//放大的时候X值不增多


    YAxis yAxisRight = barChart.getAxisRight();
    yAxisRight.setEnabled(false);
    YAxis yAxisLeft = barChart.getAxisLeft();
    yAxisLeft.setAxisMinimum(0);

    barChart.setDrawBarShadow(false);
    barChart.setPinchZoom(true);
    barChart.setFitBars(true);
    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    barChart.setMaxVisibleValueCount(60);

    barChart.setDrawValueAboveBar(true);

    barChart.getDescription().setEnabled(false);
    barChart.setNoDataText("无数据");

    Legend l = barChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    //设置单方向和双方向缩放 true x,y方向可以同时控制,false只能控制x方向的缩小放大或者Y方向的缩小放大
    l.setDrawInside(false);
    l.setFormSize(8f);
    l.setXEntrySpace(4f);
    return barChart;
}
 
Example #22
Source File: MeasurementSpectrumFragment.java    From NoiseCapture with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    if(view == null) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_measurement_spectrum, container, false);
        BarChart sChart = (BarChart) view.findViewById(R.id.spectrumChart);
        sChart.setDrawBarShadow(false);
        sChart.setDescription("");
        sChart.getLegend().setEnabled(false);
        sChart.setTouchEnabled(false);
        sChart.setPinchZoom(false);
        sChart.setDrawGridBackground(false);
        sChart.setMaxVisibleValueCount(0);
        sChart.setHorizontalScrollBarEnabled(false);
        sChart.setVerticalScrollBarEnabled(false);
        sChart.setNoDataTextDescription(getText(R.string.no_data_text_description).toString());
        // XAxis parameters:
        XAxis xls = sChart.getXAxis();
        xls.setPosition(XAxis.XAxisPosition.BOTTOM);
        xls.setDrawAxisLine(true);
        xls.setDrawGridLines(false);
        xls.setDrawLabels(true);
        xls.setTextColor(Color.WHITE);
        xls.setAvoidFirstLastClipping(false);
        // YAxis parameters (left): main axis for dB values representation
        YAxis yls = sChart.getAxisLeft();
        yls.setDrawAxisLine(true);
        yls.setDrawGridLines(true);
        yls.setAxisMaxValue(100.f);
        yls.setAxisMinValue(0f);
        yls.setTextColor(Color.WHITE);
        yls.setGridColor(Color.WHITE);
        yls.setSpaceBottom(0);
        yls.setSpaceTop(0);
        yls.setValueFormatter(new SPLValueFormatter());
        // YAxis parameters (right): no axis, hide all
        YAxis yrs = sChart.getAxisRight();
        yrs.setEnabled(false);
    }
    return view;
}
 
Example #23
Source File: HistogramChart.java    From walt with Apache License 2.0 4 votes vote down vote up
public HistogramChart(Context context, AttributeSet attrs) {
    super(context, attrs);
    inflate(getContext(), R.layout.histogram, this);

    barChart = (BarChart) findViewById(R.id.bar_chart);
    findViewById(R.id.button_close_bar_chart).setOnClickListener(this);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HistogramChart);
    final String descString;
    final int numDataSets;
    final float binWidth;
    try {
        descString = a.getString(R.styleable.HistogramChart_description);
        numDataSets = a.getInteger(R.styleable.HistogramChart_numDataSets, 1);
        binWidth = a.getFloat(R.styleable.HistogramChart_binWidth, 5f);
    } finally {
        a.recycle();
    }

    ArrayList<IBarDataSet> dataSets = new ArrayList<>(numDataSets);
    for (int i = 0; i < numDataSets; i++) {
        final BarDataSet dataSet = new BarDataSet(new ArrayList<BarEntry>(), "");
        dataSet.setColor(ColorTemplate.MATERIAL_COLORS[i]);
        dataSets.add(dataSet);
    }

    BarData barData = new BarData(dataSets);
    barData.setBarWidth((1f - GROUP_SPACE)/numDataSets);
    barChart.setData(barData);
    histogramData = new HistogramData(numDataSets, binWidth);
    groupBars(barData);
    final Description desc = new Description();
    desc.setText(descString);
    desc.setTextSize(12f);
    barChart.setDescription(desc);

    XAxis xAxis = barChart.getXAxis();
    xAxis.setGranularityEnabled(true);
    xAxis.setGranularity(1);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setValueFormatter(new IAxisValueFormatter() {
        DecimalFormat df = new DecimalFormat("#.##");

        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return df.format(histogramData.getDisplayValue(value));
        }
    });

    barChart.setFitBars(true);
    barChart.invalidate();
}
 
Example #24
Source File: HistogramChart.java    From walt with Apache License 2.0 4 votes vote down vote up
BarChart getBarChart() {
    return barChart;
}
 
Example #25
Source File: StatisticsCache.java    From privacy-friendly-shopping-list with Apache License 2.0 4 votes vote down vote up
public BarChart getChart()
{
    return chart;
}
 
Example #26
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);
}
 
Example #27
Source File: BarChartCard.java    From ResearchStack with Apache License 2.0 4 votes vote down vote up
public BarChart getChart() {
    return chart;
}
 
Example #28
Source File: XAxisRendererHorizontalBarChart.java    From android-kline with Apache License 2.0 4 votes vote down vote up
public XAxisRendererHorizontalBarChart(ViewPortHandler viewPortHandler, XAxis xAxis,
        Transformer trans, BarChart chart) {
    super(viewPortHandler, xAxis, trans);

    this.mChart = chart;
}
 
Example #29
Source File: BarChartManager.java    From react-native-mp-android-chart with MIT License 4 votes vote down vote up
@ReactProp(name = "drawHighlightArrow")
public void setDrawHighlightArrow(BarChart chart, boolean enabled) {
    chart.setDrawHighlightArrow(enabled);
}
 
Example #30
Source File: XAxisRendererHorizontalBarChart.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
public XAxisRendererHorizontalBarChart(ViewPortHandler viewPortHandler, XAxis xAxis,
        Transformer trans, BarChart chart) {
    super(viewPortHandler, xAxis, trans);

    this.mChart = chart;
}