1

Following the answers on my previous question in June, I would like to use the icCube HSL() formula to define the colors of the chart members in the amChart widget.

In the standard schema Sales I use the following MDX:

with
member [measures].[hue] as 16
member [measures].[saturation] as 1-indexof([Rubriek].[Rubriek].currentmember.siblings,[Rubriek].[Rubriek].currentmember)/30
member [measures].[lightness] as 0.2+ordinal(level([Rubriek].[Rubriek].currentmember))/10
member [measures].[color-hsl] as hsl([hue],[saturation],[lightness])
member [measures].[color-fixed] as "#FF0000"

SELECT
{ {[Measures].[Amount],[measures].[color-hsl],[measures].[color-fixed]} } ON COLUMNS,
{ [Product].[Product].firstNotAllLevel().allmembers } ON ROWS
 FROM [Sales]

I have added 2 color fields:

  • color-hsl = the HSL defined color based on level depth of the product hierarchy and the position of the member among its siblings

  • color-fixed = just a hexadecimal color, for testing purposes

Now when I define a combo chart, I can set the color field in the 'Advanced properties':

  • [{"colorField":"color-hsl"}]

Except, this does not give me the calculated colors. But, if I change the colorField to color-fixed it gives me the red color as defined.

Questions:

  1. How can I achieve that the color-hsl is working. Do I have to convert it to a hexadeximal string? How can I achieve that?
  2. How can I get rid of the data value for color-hsl. I only want to use this as a field to define the color, not the value (that is the "Amount") field in my mdx?
4

1 に答える 1

1

MDX の color 関数は、2334 などの整数値を返します。ブラウザで使用する場合は、16 進数の文字列表現に変換する必要があります。

返す ToHexColor ( colorAsInteger )

于 2015-09-28T13:49:45.290 に答える