Trying to get Battery chart to show multicolored like LOGICALDRIVES

Forums Desktop Info Trying to get Battery chart to show multicolored like LOGICALDRIVES

Viewing 4 reply threads
  • Author
    Posts
    • #3255 Reply
      AvatarMike Targgart

      I am trying to use the Win32-Battery code to display the percent of battery charge left on a laptop and have the Logical Drives showing as green with little data stored on drive and progress to yellow as space becomes limited to finally turning red as little drive space is available. Here is a picture to what I am referring to.Logical Drives

      However, I’d like to have the chart for the battery go the opposite direction in both terms; the chart will be full with a full battery, with red on the left, fading to yellow, then to green. As the battery charge decreases, the green will fade down to yellow, then to red.

      I don’t even know if this is possible, especially with WMI, but I also don’t know where to start. This is my config, so far:

      # Sample configuration file
      # See the manual for a full description of all options
      
      [options]
      
      # size and position
      top=5
      right=5
      width=390
      column1width=110
      centerv=0
      centerh=0
      
      #font 
      fontface=Calibri
      font-size=12
      cleartype=0
      ssfontsize=18
      formcolor=000000
      transparency=80
      contextmenu=0
      allowdrag=0
      offset=0
      inimonitortime=10
      
      # logging
      #log=desktopinfo.log
      #log-level=error
      
      # navigation buttons
      nav=0
      
      #[screen-saver]
      #font-face=Comic Sans MS
      #font-size=16
      #centerv=1
      #centerh=1
      
      [items]
      
      # page 1 date/time
      COMMENT=active:0,color:eeeeee,font-size:140%,style:iwb,text:Desktop Info by Glenn Delahoy,lid:banner
      HOST=active:1,interval:0,color:ffdd99,style:b,text:Host Name:
      USER=active:1,interval:0,color:ffdd99,style:b,text:User Name:
      DATETIME=active:0,interval:10,color:#42c8f4,text:Today's Date,display:%1[ddd] %2[1.0d] %3[mmm] %4[yyyy]\, %5[1.0a]:%6[2.0d] %5[2.0P]
      WMI=active:0,interval:60,text:Battery,namespace:root\cimv2,query:Win32_Battery,display:%EstimatedChargeRemaining%% (%battery%BatteryStatus%%)
      BOOTTIME=active:1,interval:1,color:00ccee,style:n,text:Last Boot:,display:%3/%2/%4 %5:%6:%7 %5[2.0P]
      UPTIME=active:1,interval:1,color:00ccee,style:n,text:Up Time:,display:%1days\, %2hrs\, %3min\, %4sec
      
      # page 1 - cpu
      WMI=active:0,interval:5,hide-no-result:1,text:Cpu Temp,namespace:root\wmi,query:MSAcpi_ThermalZoneTemperature,display: {{1.1f:%CurrentTemperature%/10-273.15}}C / {{1.1f:%CriticalTripPoint%/10-273.15}}C
      CPU=active:0,interval:3,text:CPU Usage:,chart:0 line linear 100 1 00ff00 2 bb00bb,threshold1:1 80 0000ff,threshold2:2 40 0000ff,display:Total: %1[2.0f]%\, Krnl: %2[2.0f]%
      TOPPROCESSCPU=active:0,interval:10,font-size:80%,text:Top Cpu,display:%1 (pid:%2) %3%
      
      # page 1 - memory
      COMMENT=active:0,color:cccccc,style:,text:
      PHYSICALRAM=active:0,interval:30,text:RAM Usage:,font-size:100%,color:ffe8ff,threshold1:3 80 0000FF,display:%1[3.1b]B / %2[3.1b]B (%3% used)
      TOPPROCESSMEM=active:0,interval:10,font-size:100%,color:dde0dd,counter:pu,text:Top Memory,display:%1 (pid:%2) %3[1.1b]B
      PAGEFAULTS=active:0,interval:5,color:ffe8ff,font-size:100%,threshold1:5 -80 2222e0,display:Tot: %1\, Hrd: %2\, Hit: %5%
      TOPPROCESSPF=active:0,interval:10,color:dde0dd,font-size:100%,text:Top Page Faults,display:%1 (pid:%2) %3 faults
      
      # page 1 - network
      COMMENT=active:0,color:cccccc,style:,text:
      ALLIPADDRESS=active:0,interval:30,style:n,color:f5cc27,text:IP Address:,activeonly:1
      WMI=active:0,interval:3,hide-no-result:1,color:60e8ff,font-size:100%,chart:line log 100 1 00ff00 2 bb00bb,threshold1:1 4000000 2222ee,threshold2:2 4000000 1010f0,text:Wifi Traffic:,namespace:root\cimv2,query:Win32_PerfFormattedData_Tcpip_NetworkInterface where Name like "%Wireless%",display:Rcvd: %BytesReceivedPersec%[3.1b]Bps\, Sent: %BytesSentPersec%[3.1b]Bps |Bandwidth: %CurrentBandwidth%[1.0B]B
      WMI=active:0,interval:3,hide-no-result:1,color:60e8ff,font-size:100%,chart:line log 100 1 00ff00 2 bb00bb,threshold1:1 4000000 00ff00,threshold2:2 4000000 1010f0,text:Ethernet Traffic:,namespace:root\cimv2,query:Win32_PerfFormattedData_Tcpip_NetworkInterface where Name like "%Network%" and CurrentBandwidth>0,display:Rcvd: %BytesReceivedPersec%[3.1b]Bps\, Sent: %BytesSentPersec%[3.1b]Bps |Bandwidth: %CurrentBandwidth%[1.0B]B
      WMI=active:0,interval:3,hide-no-result:1,color:60e8ff,font-size:100%,chart:line log 100 1 00ff00 2 bb00bb,threshold1:1 4000000 2222ee,threshold2:2 4000000 1010f0,text:Ethernet Traffic:,namespace:root\cimv2,query:Win32_PerfFormattedData_Tcpip_NetworkInterface where Name like "%Ethernet%" and CurrentBandwidth>0,display:Rcvd: %BytesReceivedPersec%[3.1b]Bps\, Sent: %BytesSentPersec%[3.1b]Bps |Bandwidth: %CurrentBandwidth%[1.0B]B
      
      # page 1 - disks
      COMMENT=active:0,color:cccccc,style:,text:
      LOGICALDRIVES=active:1,interval:5,diskio:0,color:60ef99,font-size:100%,text:Logical Drives:,chart:bar linear 100 7 75,threshold1:11 10000000 ff00f0,threshold2:13 10000000 0060f0,display:%1:%3 %6[1.0B]B/%5[1.0B]B (%7[1.1f]% used)|%chart%
      
      # page 1 - battery
      COMMENT=active:0,color:cccccc,style:,text:
      set=key:battery1,value:Connected
      set=key:battery2,value:Disconnected
      WMI=active:1,interval:30,hide-no-result:1,color:60ef99,font-size:100%,text:Battery Charge:,namespace:root\cimv2,query:Win32_Battery,display:%EstimatedChargeRemaining%%,chart:bar linear 100 15 -10,threshold1:15 -5 0000ff
      

      Thanks for any help that you could provide.

      0
    • #3256 Reply
      AvatarMike Targgart

      It seems my picture didn’t make it in. Here is a link to it.Logical_Drives.png

      0
    • #3258 Reply
      GlennGlenn
      Keymaster

      I presume what you are referring to is what I call a negative bar chart. A negative bar chart is like the battery where 100% is good and 0% is bad.

      A normal positive bar chart starts green when it is empty and gradiates to red as it fills up. A negative bar chart starts green when it is full and switches to red when it is nearly empty.

      Currently the bar chart always paints from left to right and stops when it reaches the correct value. On a positive bar chart the colour will gradiate as the chart fills up and approaches the threshold values. On a negative bar chart the colour will simply switch from green to red when it hits that final threshold value.

      If I were to do a regular gradient on a negative bar chart, it will show red *and* green when things are good, when the container is full. As the value drops towards zero, the green is removed, leaving the red. This is not right. When I see a red chart that means something needs attention.

      So, the difference with a negative bar chart is it will paint the whole bar with the colour applicable to the data value. This is so I don’t see red when the battery is at 100%.

      The only thing I can think of is make the whole bar colour closer to the actual data value, that is, it can be anywhere on the gradient from green to yellow to red, but the whole bar will be that colour, instead of either green or red.

      Remember, bad is not good.

      The chart you posted is a standard positive bar chart with red at the right and green at the left.

      Having said all that, if your question is simply “How do I do a bar chart for the battery?” then I refer you to the advanced ini file which contains the following item:

      WMI=interval:60,text:Battery,threshold1:15 -20 %red%,namespace:root\cimv2,query:Win32_Battery,display:%EstimatedChargeRemaining%% (%battery%BatteryStatus%%)

      • This reply was modified 2 weeks ago by GlennGlenn.
      • This reply was modified 2 weeks ago by GlennGlenn.
      • This reply was modified 2 weeks ago by GlennGlenn.
      0
    • #3267 Reply
      AvatarMike Targgart

      Thanks, Glenn. What you referred to as a negative gradient bar chart sounds exactly what I was looking for.

      For now, the WMI line I posted in my initial question will suffice.

      0
    • #3271 Reply
      GlennGlenn
      Keymaster

      You won’t get a gradient on the negative bar for the reasons explained. However, I’ll raise an issue to look into the negative bar chart colour getting closer to the data value.

      0
Viewing 4 reply threads
Reply To: Trying to get Battery chart to show multicolored like LOGICALDRIVES
Your information:




Do NOT follow this link or you will be banned from the site!