PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.59k stars 9.02k forks source link

Tooltip not showing on Horizontal or Vertical Bar chart when all values are negatives. #3369

Open checoalejandro opened 7 years ago

checoalejandro commented 7 years ago

Hi, it seems like for Horizontal or Vertical Bar Chart, marker views are not being drawn when all values are negatives, it doesn't reach the refreshContent method of the marker view. If you change all values to positive and negative, it will load refreshContent method and also the marker view.

I just checked that inside Chart, the method drawMarkers is doing a validation of checking if is in bounds and every iteration goes to continue in this validation so it never calls refreshContent or draw of the markerView.

checoalejandro commented 7 years ago

This is what I have: `horizontalBarChart = findViewById(R.id.horizontalBar); horizontalBarChart.setMarker(new CustomMarkerView(this, R.layout.custom_marker_view_layout));

    List<BarEntry> entries = new ArrayList<>();
    entries.add(new BarEntry(0f, -30f));
    entries.add(new BarEntry(1f, -80f));
    entries.add(new BarEntry(2f, -60f));
    entries.add(new BarEntry(3f, -50f));
    // gap of 2f
    entries.add(new BarEntry(5f, -70f));
    entries.add(new BarEntry(6f, -60f));

    BarDataSet set = new BarDataSet(entries, "BarDataSet");
    BarData data = new BarData(set);
    data.setBarWidth(0.9f); // set custom bar width
    horizontalBarChart.setData(data);
    horizontalBarChart.setFitBars(true); // make the x-axis fit exactly all bars
    horizontalBarChart.invalidate(); // refresh`
suvDev commented 4 years ago

Any solution on this? , see i am too facing a similar issue: https://stackoverflow.com/questions/59541099/set-the-negative-values-to-the-left-of-the-bars-in-horizontal-bar-chart

omkarshisode commented 1 year ago

have you find the solution for it ?