I'm creating a series of small graphs to fit within a column. I have them working as intended but am trying to squeeze every extra pixel I can. I've attached a picture...is there a way to remove any/all of the green circled sections? The Y axis label isn't a huge deal since I sometimes will need it for other graphs, but there are blank sections on either end I'd like to use to stretch the graph a bit more on the X axis.
edit: second question: i know how to reduce the ticks on the X axis, but how do I make them horizontal instead of diagonal? Even when I reduce the amount and theres space in between, they stay diagonal.
Tiny graphs - Maximizing space
Moderators: leecollings, htilburgs, robgeerts
-
- Posts: 42
- Joined: Friday 28 April 2017 19:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: USA
- Contact:
Tiny graphs - Maximizing space
- Attachments
-
- Screenshot 2022-07-21 130022.jpg (32.4 KiB) Viewed 660 times
Re: Tiny graphs - Maximizing space
did you found a solution for this and if so can you share the code for this tiny graph? thanks in advance
docker with sonos http api / mosquitto / zigbee2mqtt assistant / portainer / dashticz / nodeJS on windows with Zigbee2Mqtt, and some flask builds of my own
-
- Posts: 2287
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Tiny graphs - Maximizing space
You can use the undocumented 'options' parameter for a few things.
To remove the y-axis label, and to keep the x-axis tick marks horizontal, add the following:
To remove the y-axis label, and to keep the x-axis tick marks horizontal, add the following:
Code: Select all
blocks['graph_2'] = {
options : {
scales: {
yAxes: [{
scaleLabel: {
display: false
}
}
],
xAxes: [{
ticks: {
maxRotation: 0
}
}
]
}
}
}
-
- Posts: 2287
- Joined: Monday 29 August 2016 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Tiny graphs - Maximizing space
In addition, to maximize the space, you can also slightly scale the graph.
In custom.css add the following
In custom.css add the following
Code: Select all
.dt_block[data-id='graph_2'] .graphcontent {
transform: scale(1.05,1.05)
}
-
- Posts: 42
- Joined: Friday 28 April 2017 19:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: USA
- Contact:
Re: Tiny graphs - Maximizing space
thanks for the reply!
config.js:
and custom.css:
here's my final (just the relevant block)-
config.js:
Code: Select all
blocks['energygraph'] = {
devices: [370],
height: '125px',
width: 12,
datasetColors: ['white'],
maxTicksLimit: 12,
custom: {
"today": {
range: 'today',
data: {
Usage: 'd.v_370'
}
}
},
options : {
scales: {
yAxes: [{
scaleLabel: {
display: false
}
}
],
xAxes: [{
ticks: {
maxRotation: 0,
}
}
]
}
}
}
Code: Select all
[data-id='energygraph'].graph .graphheader {
display: none;
}
.dt_block[data-id='energygraph'] .graphcontent {
transform: scale(1.06,1.20);
margin-left:15px
}
Who is online
Users browsing this forum: No registered users and 1 guest