-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New-TablePercentageBar - Conditional BarColor? #408
Comments
hi, Not sure it's natively possible: The JS code is here: Source codes (to commit back to DataTables after fixes) This would require some modification to support conditions, but doable. Some links to consider: |
I actually just hardcoded this and it seems to work, so I'll work on it to make it nice and fancy |
Gotcha, I didn't assume it was tied directly to DataTables - thanks! My current workaround is to use manual HTML with -InvokeHTMLTags:
Very ugly but works...my biggest issue was trying to make it 'pretty' as I am not familiar with CSS, etc... |
I've created PR for this change in datatables. Lets see how that works out. I'll probably release my own version until they process it properly on their own side. |
From a PowerShell perspective: $DataTable = @(
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 1.42; Percents = 50 }
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 5.72; Percents = 5 }
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 16.22; Percents = 17 }
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 23.73; Percents = 99 }
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 50.73; Percents = 105 } # will be trimmed to 100%
[PSCustomObject] @{ Test = 'Name'; Test2 = 'Name2'; Test3 = 'Name3'; Test4 = 90; Percents = 105 } # will be trimmed to 100%
)
New-HTML {
New-HTMLTable -DataTable $DataTable -AlphabetSearch {
New-TablePercentageBar -ColumnID 4 # runs on defaults
New-TablePercentageBar -ColumnID 3 -BackgroundColor Blue -TextColor White -BorderColor Grey -BarColor gold -BorderStyle ridge -Type round {
New-TablePercentageBarCondition -Minimum 0 -Maximum 10 -BackgroundColor Blue -TextColor White -BarColor Red
New-TablePercentageBarCondition -Minimum 11 -Maximum 20 -BackgroundColor Blue -TextColor White -BarColor Green
New-TablePercentageBarCondition -Minimum 21 -Maximum 25 -BackgroundColor Blue -TextColor White -BarColor AppleBlossom
New-TablePercentageBarCondition -Minimum 26 -Maximum 85 -BackgroundColor Grey -TextColor Black -BarColor Cyan
New-TablePercentageBarCondition -Minimum 86 -Maximum 100 -BackgroundColor Blue -TextColor White -BarColor Yellow
}
} -ImmediatelyShowHiddenDetails
} -ShowHTML -FilePath $PSScriptRoot\Example7_PercentageBar.html -Online |
Love it, as usual! Thanks! |
It is, but was working without |
Thanks! |
With New-TablePercentageBar it doesn't seem possible to create a condition for things like BarColor?
Ideally, being able to say something like the following would be great:
Love this addition, not sure when it popped in, just needs this one tweak to be super useful!
The text was updated successfully, but these errors were encountered: