| 143036 | return s ? s(value) : undefined; |
| 143037 | } |
| 143038 | function scaleGradient(scale1, p0, p1, count, group) { |
| 143039 | scale1 = getScale(scale1, (group || this).context); |
| 143040 | const gradient = (0, _vegaScenegraph.Gradient)(p0, p1); |
| 143041 | let stops = scale1.domain(), min = stops[0], max = (0, _vegaUtil.peek)(stops), fraction = (0, _vegaUtil.identity); |
| 143042 | if (!(max - min)) // expand scale if domain has zero span, fix #1479 |
| 143043 | scale1 = (scale1.interpolator ? (0, _vegaScale.scale)("sequential")().interpolator(scale1.interpolator()) : (0, _vegaScale.scale)("linear")().interpolate(scale1.interpolate()).range(scale1.range())).domain([ |
| 143044 | min = 0, |
| 143045 | max = 1 |
| 143046 | ]); |
| 143047 | else fraction = (0, _vegaScale.scaleFraction)(scale1, min, max); |
| 143048 | if (scale1.ticks) { |
| 143049 | stops = scale1.ticks(+count || 15); |
| 143050 | if (min !== stops[0]) stops.unshift(min); |
| 143051 | if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max); |
| 143052 | } |
| 143053 | stops.forEach((_)=>gradient.stop(fraction(_), scale1(_))); |
| 143054 | return gradient; |
| 143055 | } |
| 143056 | function geoShape(projection, geojson, group) { |
| 143057 | const p = getScale(projection, (group || this).context); |
| 143058 | return function(context) { |