Code Monkey home page Code Monkey logo

squarifiedtreemap's Introduction

SquarifiedTreemap

Code to generate a squarified treemap UI for data visualization

Now with Customizable Label and Passthru support!

#region Stopping a high memory process
$Tooltip = {
@"
Process Name <PID>:   $($This.LabelProperty) <$($This.ObjectData.Id)>     
WorkingSet Memory(MB): $([math]::Round(($This.DataProperty/1MB),2))
"@
}
Get-Process | Sort-Object -prop WS -Descending | Select -First 8 | 
Out-SquarifiedTreeMap -Tooltip $Tooltip -LabelProperty ProcessName -DataProperty WS -HeatmapProperty WS -Width 800 -Height 600 `
-PassThru -ShowLabel {"$($This.LabelProperty) <$($This.ObjectData.ID)>"} | 
Stop-Process -WhatIf
#endregion Stopping a high memory process

alt tag

#region Example using randomized data
1..8 | ForEach{
    [pscustomobject]@{
        Label = "Label$($_)"
        Count = (Get-Random -InputObject (1..50))
        Data = (Get-Random -InputObject (1..100))
    }
} | Out-SquarifiedTreeMap -Width 600 -Height 200 -DataProperty Count -HeatmapProperty Data -LabelProperty Label
#endregion Example using randomized data

alt tag

#region Example using Filesystem against my current drive
$FileInfo = Get-ChildItem -Directory|ForEach {
    $Files = Get-ChildItem $_.fullname -Recurse -File|measure-object -Sum -Property length
    [pscustomobject]@{
        Name = $_.name
        Fullname = $_.fullname
        Count = [int64]$Files.Count
        Size = [int64]$Files.Sum
    }
}
#endregion Example using Filesystem against my current drive

#region Create a custom tooltip
$Tooltip = {
@"
Fullname = $($This.LabelProperty)
FileCount = $($This.Dataproperty)
Size = $([math]::round(($This.HeatmapProperty/1MB),2)) MB
"@
}

#Create the UI
$FileInfo | 
Out-SquarifiedTreeMap -Width 600 -Height 200 -LabelProperty Fullname -DataProperty Count -HeatmapProperty Size -ToolTip $Tooltip
#endregion Create a custom tooltip

alt tag

squarifiedtreemap's People

Contributors

proxb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

squarifiedtreemap's Issues

Found a bug with ShowLabel - newest version

Once you swtiched showlabel from string to scriptblock as a param, I now get the following error: Cannot process argument transformation on parameter 'ShowLabel'. Cannot convert the "LabelProperty" value of type "System.String" to
type "System.Management.Automation.ScriptBlock".

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.