Giter VIP home page Giter VIP logo

Comments (7)

 avatar commented on May 28, 2024 1

Hello! Hereʼs a quick example. I hope it helps.

<com.patrykandpatryk.vico.view.chart.ChartView
    android:id="@+id/chart"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:showBottomAxis="true"
    app:showStartAxis="true" />
with (binding.chart) {
    setModel(
        model = entryModelOf(
            0f to 10f,
            5f to 15f,
            10f to 20f,
        ),
    )
    chart = ColumnChart(
        column = LineComponent(
            thicknessDp = 24f,
            color = Color.BLACK,
        ),
    )
    (startAxis as Axis).guideline = null
    with (bottomAxis as Axis) {
        guideline = null
        valueFormatter = AxisValueFormatter { _, _ -> "Test" }
    }
}

image

from vico.

Gowsky avatar Gowsky commented on May 28, 2024

Hi @khmaies5!

You can define the columns’ (bars’) thickness right in LineComponent’s constructor. Alternatively you can use lineComponent() function if you are using Jetpack Compose.

In order to hide the guidelines, you need to set guideline to null while creating an axis.
You can use a horizontal axis builder, or vertical axis builder. There's also compose-only functions such as startAxis() etc.

from vico.

khmaies5 avatar khmaies5 commented on May 28, 2024

I will check it out, also I am not using compose.
I believe that this lib has a lot of potential but it's not well documented or not having enough examples on how to use it in different scenarios (i am talking about not so advanced developers)

from vico.

khmaies5 avatar khmaies5 commented on May 28, 2024

Hi @khmaies5!

You can define the columns’ (bars’) thickness right in LineComponent’s constructor. Alternatively you can use lineComponent() function if you are using Jetpack Compose.

In order to hide the guidelines, you need to set guideline to null while creating an axis. You can use a horizontal axis builder, or vertical axis builder. There's also compose-only functions such as startAxis() etc.

I changed the thickness and hid the guideline using styling for the column bar but that messedup the view so i tried to do what you told me but i wasn't successful (how to add the lineComponent constructor to the column chart).
I am using the sample app.

one other reauest, can we edit the y&x axis steps? for example i want the x axis to count from 0 to 10 and step by 5 so it shows 0->5->10 and the y axis to show 24h format from 00:00 -> 08:00 -> 16:00 -> 00:00

from vico.

Gowsky avatar Gowsky commented on May 28, 2024

(how to add the lineComponent constructor to the column chart).

The ColumnChart’s constructor accepts both single column LineComponent, as well as a list of columns. I can’t see what problem you may have with that.

i want the x axis to count from 0 to 10 and step by 5

Simply add your list of ChartEntry with 0, 5, 10 x-axis values.

Alternatively use custom AxisValueFormatter that converts x-axis values to whatever you need. An then set it to your Axis.

y axis to show 24h format from 00:00 -> 08:00 -> 16:00 -> 00:00

Use the AxisValueFormatter, as I’ve mentioned before.

from vico.

khmaies5 avatar khmaies5 commented on May 28, 2024

Thank you, this is really helpful

from vico.

Gowsky avatar Gowsky commented on May 28, 2024

I assume that this issue can be closed now.

from vico.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.