![]() |
|
chartist to display nice pie... - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2) +--- Thread: chartist to display nice pie... (/showthread.php?tid=3789) |
RE: chartist to display nice pie... - admin - 31.10.2025 It should already be possible to do using HTML widget. RE: chartist to display nice pie... - stianj - 31.10.2025 Ok, thanks. But in that case using CSS and not Chartist.js..? Because I also have some of these: Code: // UPS LoadRE: chartist to display nice pie... - admin - 31.10.2025 Old JS examples won't work. New Visu does not use jQuery so the $ function won't work. localbus should be used instead of grp. Function reference: https://kb.logicmachine.net/misc/visu/ A major difference is that old visu rendered all plans and widgets once loaded but new Visu renders only the currently active plan. RE: chartist to display nice pie... - stianj - 03.11.2025 This turned a bit off topic, but... I can use this: Code: localbus.listen('object', '35/0/6', (value) => {and have this in a html-widget: Code: <progress id="p1" value="0" max="100"></progress>and it works - after the first update of 35/0/6. Since the JS is run before the page is completely rendered, I have no way to have this value from start. I'm sure there is a workaround I just don't understand..? RE: chartist to display nice pie... - domotiqa - 03.11.2025 (31.10.2025, 12:36)stianj Wrote: Ok, thanks. But in that case using CSS and not Chartist.js..? hello. I wasn't aware of this change. so it mean if we upgrade our customer building that use chartist, they will not have it working anymore ? RE: chartist to display nice pie... - admin - 03.11.2025 @stianj, you need to listen to widget-ready and widget-hide events and only then execute localbus.listen / localbus.unlisten. Or you can use slider in read-only mode without the handle to display a progress bar. Set Additional classes to slider-progress. You can adjust active / inactive color as needed. Code: .slider-progress {@domotiqa, as mentioned before any Custom JS and CSS from old visu won't work with new Visu. RE: chartist to display nice pie... - stianj - 03.11.2025 Thanks, using the slider widget is the right solution here (especially since I wasn't able to get any listen-events working). But this is much cleaner anyway. Code: .slider-progress {But it's minimum width of 200px is a bit too much for me. 150 would be much better ? And to get back on topic, would still really, really like a way to use Chartist.js or another similar library. RE: chartist to display nice pie... - stianj - 04.11.2025 (30.10.2025, 13:57)admin Wrote: What exactly do you want to display in this chart? Maybe making a new widget for this is a better solution. Maybe I've changed my mind. The trend widget is actually quite good. So if there would be a widget that resembles the Home Assistant history graph then I would be happy ![]() (Of course, given identical size and time span/resolution, the x-axis must match the trend widget) For me that would be incredibly useful! ? RE: chartist to display nice pie... - admin - 04.11.2025 Here's a working example for HTML progress element. HTML widget contents: Code: <progress max="100" class="w-100"></progress>Custom JS, change widgetId and addr as needed: Code: const widgetId = 123Trends cannot be used to display on/off times for a binary object. Trends aggregate the data without storing changes as exact timestamps. For this you need something like Graph widget from old visu that uses data from object logs. RE: chartist to display nice pie... - stianj - 04.11.2025 Really appreciate the example, it will for sure be useful for other things! Thank you! And yes, I didn't mean that the Trends widget could or should be used for showing on/off states. But I was hoping you'd consider making a separate widget that does just this. It's an very convenient way of visualizing the object logs... |