Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
stascher
Partner - Creator II
Partner - Creator II

Initializing custom color picker object

I'm adding the ability to select a custom color for each measure in my extension. 

So far everything is working.. I see the color picker, I can select a color and that color is reported in the hypercube.

The problem I'm having is setting the initial value in the picker itself, it always displays as blank. Here's my code:

					measures: {
						uses: "measures",
						min: 1,
						max: 6,
						type:"items",
						items: {
							VisualType: {
								type: "string",
								component:"dropdown",
								label: "Visual Type",
								ref: "qDef.visualType",
								options: [{
									value: "BAR",
									label: "Bar"
								},{
									value: "LINE",
									label: "Line"
								},{
									value: "POINT",
									label: "Point"
								}],
								defaultValue: "BAR"
							},
							VisualColor: {
								type:"object",
								component:"color-picker",
								label:"Visual Color",
								ref: "qDef.visualColor",
								defaultValue: {
									color: "ff5866",
									index: "-1"
								}
							}
						},
						paint: function($element,layout) {
							$element.css("background-color",layout.qDef.visualColor);
						}
					},

Thanks in advance for any help,

Steve

Labels (3)
1 Reply
stascher
Partner - Creator II
Partner - Creator II
Author

I think the problem is that the example I took my code from specifies a default value of "ff5866" when in fact it should have been "#ff5866".