Comments (7)
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" }
}
}
from vico.
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.
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.
Hi @khmaies5!
You can define the columns’ (bars’) thickness right in
LineComponent
’s constructor. Alternatively you can uselineComponent()
function if you are using Jetpack Compose.In order to hide the guidelines, you need to set
guideline
tonull
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.
(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.
Thank you, this is really helpful
from vico.
I assume that this issue can be closed now.
from vico.
Related Issues (20)
- Collection contains no element matching the predicate HOT 4
- Line chart with only one value doesn't display long x value even when there is space for it HOT 3
- 2.0.0-alpha.11 sample app main screen goes blank HOT 3
- Space above line chart. HOT 2
- IllegalStateException: Reading a state with latest compose alphas HOT 1
- Marker didn't show "0" value HOT 5
- Data Labels for Stacked bar chart have wrong position and value HOT 2
- Marker missing style defined by custom MarkerLabelFormatter HOT 7
- Cannot access CartesianChartHost in my project HOT 2
- Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied HOT 6
- Cannot make a LabelFormatter on stacked column chart HOT 11
- Markers only works for the first line series HOT 2
- Crash on changing dataset which contains negative values HOT 3
- Throwing OOM Exception when using Chart in LazyColumn HOT 6
- Marker duplicated HOT 2
- No axisValueOverrider in rememberCandlestickCartesianLayer HOT 4
- Feature Missing - Slide to Position HOT 4
- Text alignment on y-axis label only shown correctly for ALIGN_NORMAL HOT 3
- [View] CartesianChartView always handles touches, even if `isClickable` or `isEnabled` is false HOT 4
- Cannot Round NaN to Float HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vico.