StyleCode Property: unit
unit
Controls the unit of numbers in the number pipeline.
Examples
// Example: barchart > vaxis > left
table Items = with
[| as SKU, as Category, as Quantity |]
[| "AAA", "CAT_1", 10 |]
[| "BBB", "CAT_2", 20 |]
[| "CCC", "CAT_1", 30 |]
{ vaxis { left { unit: "$" } } }
show barchart "My BarChart" a1b6 with
sum(Items.Quantity)
group by Items.Category
// Example: barchart > vaxis > right
table Items = with
[| as SKU, as Category, as Quantity |]
[| "AAA", "CAT_1", 10 |]
[| "BBB", "CAT_2", 20 |]
[| "CCC", "CAT_1", 30 |]
{ vaxis { right { unit: "$" } } }
show barchart "My BarChart" a1b6 with
sum(Items.Quantity)
group by Items.Category
// Example: barchart > series
table Items = with
[| as SKU, as Category, as Quantity |]
[| "AAA", "CAT_1", 10 |]
[| "BBB", "CAT_2", 20 |]
[| "CCC", "CAT_1", 30 |]
show barchart "My BarChart" a1b6 with
sum(Items.Quantity) { unit: "$" }
group by Items.Category
// Example: barchart > series > value
table Items = with
[| as SKU, as Category, as Quantity |]
[| "AAA", "CAT_1", 10 |]
[| "BBB", "CAT_2", 20 |]
[| "CCC", "CAT_1", 30 |]
show barchart "My BarChart" a1b6 with
sum(Items.Quantity) { value { unit: "$" } }
group by Items.Category
// Example: gauge > entry > value
show gauge "My gauge" a1b2 with 0.5
// Example: histogram > series > value
table T = extend.range(1000)
T.X = random.poisson(5 into T)
show histogram "My histogram" a1f4 with T.X { value { unit: "$" } }
// Example: linechart > vaxis > left
table Day[Date] = with
[| as Date, as StockOnHand, as StockOnOrder |]
[| date(2023,01,15), 15,10 |]
[| date(2023,01,16), 5, 2 |]
[| date(2023,01,17), 12, 4 |]
[| date(2023,01,18), 13, 7 |]
{ vaxis { left { unit: "$" } } }
show linechart "My Line Chart" a1b6 with
Day.StockOnHand
Day.StockOnOrder
// Example: linechart > vaxis > right
table Day[Date] = with
[| as Date, as StockOnHand, as StockOnOrder |]
[| date(2023,01,15), 15,10 |]
[| date(2023,01,16), 5, 2 |]
[| date(2023,01,17), 12, 4 |]
[| date(2023,01,18), 13, 7 |]
{ vaxis { right { unit: "$" } } }
show linechart "My Line Chart" a1b6 with
Day.StockOnHand
Day.StockOnOrder
// Example: linechart > series
table Day[Date] = with
[| as Date, as StockOnHand, as StockOnOrder |]
[| date(2023,01,15), 15,10 |]
[| date(2023,01,16), 5, 2 |]
[| date(2023,01,17), 12, 4 |]
[| date(2023,01,18), 13, 7 |]
show linechart "My Line Chart" a1b6 with
Day.StockOnHand { unit: "$" }
Day.StockOnOrder
// Example: linechart > series > value
table Day[Date] = with
[| as Date, as StockOnHand, as StockOnOrder |]
[| date(2023,01,15), 15,10 |]
[| date(2023,01,16), 5, 2 |]
[| date(2023,01,17), 12, 4 |]
[| date(2023,01,18), 13, 7 |]
show linechart "My Line Chart" a1b6 with
Day.StockOnHand { value { unit: "$" } }
Day.StockOnOrder
// Example: piechart > series > value
table Sales = with
[| as Quantity, as Category |]
[| 10, "A" |]
[| 1, "B" |]
[| 5, "B" |]
[| 4, "A" |]
[| 12, "C" |]
show piechart "My Pie Chart" a1b6 with
sum(Sales.Quantity) { value { unit: "$" } }
group by Sales.Category
// Example: plot > series > value
table Sales = with
[| as Quantity, as Discount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 0 |]
show plot "My Plot" a1d4 with
Sales.Quantity
Sales.Discount { value { unit: "$" } }
// Example: plot > haxis
table Sales = with
[| as Quantity, as Discount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 0 |]
show plot "My Plot" a1d4 with
Sales.Quantity { unit: "$" }
Sales.Discount
// Example: plot > vaxis
table Sales = with
[| as Quantity, as Discount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 0 |]
{ vaxis { unit: "$" } }
show plot "My Plot" a1d4 with
Sales.Quantity
Sales.Discount
// Example: scalar > entry > value
myValue = 123
show scalar "My Scalar" a1b1 with
myValue { value { unit: "$" } }
// Example: scatter > series
table Sales = with
[| as Quantity, as Discount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 0 |]
show scatter "My Scatter Plot" a1d4 with
Sales.Quantity
Sales.Discount { unit: "$" }
// Example: scatter > haxis
table Sales = with
[| as Quantity, as Discount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 0 |]
show scatter "My Scatter Plot" a1d4 with
Sales.Quantity { unit: "$" }
Sales.Discount
// Example: slicepicker > entry
table Items = with
[| as Id |]
[| "A" |]
[| "B" |]
[| "C" |]
Items.Slice = sliceDashboard(Items.Id) by Items.Id
show slicepicker "Pick a slice" a1b3 with
same(Items.Id) { unit: "$" }
// Example: summary > entry > value
table Sales = with
[| as Quantity, as NetAmount |]
[| 10, 40 |]
[| 2, 10 |]
[| 1, 20 |]
show summary "My Summary" a1b3 with
sum(Sales.Quantity) { value { unit: "$" } }
sum(Sales.NetAmount)
// Example: table > column > value
table Orders = with
[| as Date, as Quantity |]
[| date(2023,02,21), 150 |]
[| date(2023,02,22), 250 |]
show table "My Table" a1c4 with
Orders.Date { value { unit: "$" } }
Orders.Quantity
// Example: treemap > series > value
table T = with
[| as Quantity, as Label |]
[| 10, "A" |]
[| 1, "B" |]
[| 5, "B" |]
[| 4, "A" |]
[| 12, "C" |]
show treemap "My Treemap" a1b6 with
sum(T.Quantity) { value { unit: "$" } }
T.Label
group by T.Label