halfhp / androidplot

Charts and plots for Android
http://androidplot.com
Apache License 2.0
511 stars 159 forks source link

I dont have renderer.setBarWidth(num) method in BarChart #116

Closed wiztensai closed 2 years ago

wiztensai commented 2 years ago

Hi, why i cant set width of bar chart and i dont have method of setBarWidth.

    `val seriesNumber = mutableListOf<Number>()
    for (i in 0..10) {
        val random = (0..10).random()
        seriesNumber.add(random)
    }

    val series = SimpleXYSeries(seriesNumber, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, "Repetition")
    bind.plot.setDomainBoundaries(-1, series.size(), BoundaryMode.FIXED)
    bind.plot.setDomainStep(StepMode.INCREMENT_BY_VAL, 1.0)
    bind.plot.setRangeUpperBoundary(SeriesUtils.minMax(series).getMaxY().toDouble() + 1, BoundaryMode.FIXED)
    bind.plot.getGraph().setDomainGridLinePaint(null)

    val seriesFormat = MyBarFormatter(Color.argb(255,0,0,100), Color.LTGRAY)
    bind.plot.addSeries(series, seriesFormat)

    val renderer = MyBarRenderer(bind.plot)
    renderer.setBarGroupWidth(BarRenderer.BarGroupWidthMode.FIXED_GAP, 1f)
    // renderer.setBarWidth(20); <- why i dont have setBarWidth method in renderer?

    bind.plot.redraw()`

this is my gradle implementation "com.androidplot:androidplot-core:1.5.9" implementation "com.halfhp.fig:figlib:1.0.11"

Image: https://ibb.co/TK2FDrT

This is full code: https://github.com/wiztensai/barchart-androidplot

Thanks

halfhp commented 2 years ago

Apologies the documentation is a little outdated here. If you are drawing a single Series, then renderer.setBarGroupWidth does exactly what you're after. The method name name changed to better reflect what this method actually does, particularly in the case when you are drawing 2 or more series.