StyleCode Property: color

color

Specifies the color of a series for the plot color pipeline.

Applies to Type Default
barchart > series
barchart > series > value
chart > block > plotxy > series
chart > block > plot > series
chart > block > scatter > series
chart > block > scatter > series > value
histogram > series
linechart > series
piechart > series > value
plot > series
scatter > series
scatter > series > value
treemap > series > value
color, gradient gradient

Examples

// 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) { color: tomato }
  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 { color: tomato } }
  group by Items.Category

// Example: histogram > series
table T = extend.range(1000)
T.X = random.poisson(5 into T)
         
show histogram "My histogram" a1f4 with T.X { color: tomato }

// 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 { color: tomato }
  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 { color: tomato } }
  group by Sales.Category

// Example: plot > series
table Sales = with
  [| as Quantity, as Discount |]
  [| 10, 40 |]
  [| 2, 10 |]
  [| 1, 0 |]
      
show plot "My Plot" a1d4 with
  Sales.Quantity
  Sales.Discount { color: tomato }

// 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 { color: tomato }

// Example: scatter > series > value
table Sales = with
  [| as Quantity, as Discount |]
  [| 10, 40 |]
  [| 2, 10 |]
  [| 1, 0 |]
    
show scatter "My Scatter Plot" a1d4 with
  Sales.Quantity
  Sales.Discount { value { color: tomato } }

// 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 { color: tomato } }
  T.Label
  group by T.Label

Details

For piechart and scatter, the color property can specified at the value level (as opposed to the series level), and is expected to be a vector, providing a different value for each piechart slice and each scatterplot point.

User Contributed Notes
0 notes + add a note