DustJS Nested Sections? - dust.js

Brownie points if you can provide some sort of feedback in this issue. Here's the JSON data
{
"options": [
"Size",
"Color"
],
"variants": [
{
"inventory": 4,
"options": [
"S",
"Red, White, Blue"
]
},
{
"inventory": 4,
"options": [
"M",
"Red, White, Blue"
]
},
{
"inventory": 0,
"options": [
"L",
"Red, White, Blue"
]
},
]
}
Here's the desire output
Size
S
M
L
Color
Red, White, Blue
This is also acceptable.
Size
S
M
L
Color
Red, White, Blue
Red, White, Blue
Red, White, Blue
I understand that I need to essentially nest the sections and match the option indexes, but not sure if it's possible with Dust JS.
{#options}
{#variants}
{.options}
// If this option id matches the parent option id, then display it
{/options}
{/variants}
{/options}

This question was answered by #rragan here. Here's the solution for reference:
{#options}
{.}{~n}
{#variants}
{.options[$idx]}{~n}
{/variants}{~n}
{/options}
Will generate
Size
S
M
L
Color
Red, White, Blue
Red, White, Blue
Red, White, Blue

Related

Can a valid GeoJSON Polygon represent an island in a lake in an island?

I was a bit puzzled to find the GeoJSON
{
"type": "Polygon",
"coordinates": [
[
[-0.8, -0.8],
[ 0.8, -0.8],
[ 0.8, 0.8],
[-0.8, 0.8],
[-0.8, -0.8]
],
[
[-0.6, -0.6],
[-0.6, 0.6],
[ 0.6, 0.6],
[ 0.6, -0.6],
[-0.6, -0.6]
],
[
[-0.4, -0.4],
[ 0.4, -0.4],
[ 0.4, 0.4],
[-0.4, 0.4],
[-0.4, -0.4]
]
]
}
an "island in a lake in an island" if you will, rejected by one online validator, but accepted by another.
Looking again at RFC7846
For Polygons with more than one of these rings, the first MUST be
the exterior ring, and any others MUST be interior rings. The
exterior ring bounds the surface, and the interior rings (if
present) bound holes within the surface.
it looks to me that the first validator was correct, the final ring does not bound a hole in the surface defined by the first ring, so is invalid. So am I right in thinking that a valid GeoJSON Polygon cannot represent an island in a lake in an island? (So one would need to use a MultiPolygon to represent it?)
Correct, the inner rings are holes in the exterior ring so cannot have an island in a lake where an inner ring is not a hole.
A valid representation of an island would be a MultiPolygon where the first polygon is the larger polygon with a hole that forms the lake and the second polygon is the smaller polygon inside the first which is the island.
Here is the GeoJSON:
{
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-0.8, -0.8],
[ 0.8, -0.8],
[ 0.8, 0.8],
[-0.8, 0.8],
[-0.8, -0.8]
],
[
[-0.6, -0.6],
[-0.6, 0.6],
[ 0.6, 0.6],
[ 0.6, -0.6],
[-0.6, -0.6]
]
], [
[
[-0.4, -0.4],
[ 0.4, -0.4],
[ 0.4, 0.4],
[-0.4, 0.4],
[-0.4, -0.4]
]
]
]
}
}

Organization Chart Double Color in 1 Box

my issue is that I need to style 1 Box (Box=Task Box, background is stylebar with Color:) with 2 Colors.
So for example a task is done 20%, the normal box is yellow. But 20% should be a darker yellow to indicate that the task is 20% complete. Is there any possible way to do this very smoothly.
Thanks in advance
Juli.w
(And Im sry for my bad english, I’m German :))
You can define the color as a Highcharts.GradientColorObject to achieve the wanted result:
nodes: [..., {
...,
color: {
linearGradient: {
x1: 0,
x2: 1,
y1: 0,
y2: 0
},
stops: [
[0, '#fffdaa'], // start
[0.25, '#fffdaa'],
[0.25, '#878300'],
[1, '#878300'] // end
]
}
}
]
Live demo: https://jsfiddle.net/BlackLabel/r6qxgLtm/
API Reference: https://api.highcharts.com/class-reference/Highcharts.GradientColorObject

How can I add a background to a pattern in Highcharts?

I am currently working with Highcharts in combination with the pattern fill module. When I set a pattern for a series in the chart, the pattern is shown but it has a transparent background. I need to set an additional background because the pattern is overlapping with another series which I don't want to see behind it. You can check this fiddle. So basically I don't want to see those three columns on the left behind the pattern. Any ideas how I can do that? I haven't seen any options to set an additional background, but maybe you know some trick. This is the code I am using for the pattern:
"color": {
"pattern": {
"path": {
"d": "M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11"
},
"width": 10,
"height": 10,
"opacity": 1,
"color": "rgb(84,198,232)"
}
}
You need to set fill attribute as a path property:
"color": {
"pattern": {
"path": {
"d": "M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11",
fill: 'red'
},
"width": 10,
"height": 10,
"opacity": 1,
"color": 'rgb(84,198,232)'
}
}
Live demo: https://jsfiddle.net/BlackLabel/m9rxwej5/
I guess there's been an update. backgroundColor should be set at pattern's root level:
"color": {
"pattern": {
"backgroundColor": 'red',
"path": {
"d": "M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11",
},
"width": 10,
"height": 10,
"opacity": 1,
"color": 'rgb(84,198,232)',
}
}
https://jsfiddle.net/vL4fqhao/

Incorrect Highcharts colorAxis range

I have a heatmap in Highcharts where the value range is from -1 to 100. My low value color is #FF0000, which I expect to be mapped to the value of -1. Instead, highcharts seems to be extending my color axis range so that a value of -25 would be shown as fully red, so my actual low value in the bottom left gets shown in a faint pink. I have tried specifying min and max values for the colorAxis, but it doesn't seem to do anything for me. How can I get the color axis configured such that my -1 value will be rendered as red?
Here's my existing colorAxis configuration, which doesn't seem to be doing the right thing:
colorAxis: {
stops: [
[0, '#FF0000'],
[0.25, '#FFFFFF'],
[0.5, '#00FF00'],
[0.75, '#FFFFFF'],
[1, '#0000FF']
],
min: -1,
max: 100
}
Here's a fiddle showing this: https://jsfiddle.net/cfarmerga/cLncce08/9/
In the below screenshot, for some reason the cursor is in the wrong place. It should be hovering over the bottom left cell in the heatmap where the value is -1.
It looks like there are startOnTick and endOnTick properties of the colorAxis that can eliminate the auto-extending axis. When I added these and set them to false, my color range is what I expect.
colorAxis: {
stops: [
[0, '#FF0000'],
[0.25, '#FFFFFF'],
[0.5, '#00FF00'],
[0.75, '#FFFFFF'],
[1, '#0000FF']
],
min: low,
max: high,
startOnTick: false,
endOnTick: false
},
The docs: https://api.highcharts.com/highmaps/colorAxis.startOnTick

gltf 2.0 BoxTextured sample

I try to understand the data in the BoxTextured Model for the TEXCOORD_0 accessor.
As seen in the capture, the datas seems correct for POSITION and NORMALS but why values in the TEXCOORD_0 accessor aren't in range of "max": [ 1.0, 1.0 ], "min": [ 0.0, 0.0 ] but have a "max": [ 6.0, 1.0 ] ?
{
"bufferView": 2,
"byteOffset": 0,
"componentType": 5126,
"count": 24,
"max": [
6.0,
1.0
],
"min": [
0.0,
0.0
],
"type": "VEC2"
}
Should those be normalized ?
My texture applied is totally wrong : Rendered with uv test texture.
Where is my misunderstanding ?
Thank you
(I know I have a problem with my face orientation but that's another problem)
The 6.0 comes from the number of faces on the cube. Note that the sampler specifies REPEAT (10497):
"samplers": [
{
"magFilter": 9729,
"minFilter": 9986,
"wrapS": 10497,
"wrapT": 10497
}
],
so the image will be tiled repeatedly. It's just a simple way to get the logo rendered on all six faces of the cube.

Resources