File tree Expand file tree Collapse file tree
packages/layerchart/src/lib/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' layerchart ' : patch
3+ ---
4+
5+ fix(Highlight|TooltipContext): Support xInterval / yInterval
Original file line number Diff line number Diff line change 264264 tmpArea .width = max (xCoord ) - min (xCoord ); // Use first/last values for width
265265 } else if (isScaleBand (ctx .xScale )) {
266266 tmpArea .width = ctx .xScale .step ();
267+ } else if (ctx .xInterval ) {
268+ // x-axis time scale with interval
269+ const start = ctx .xInterval .floor (xValue );
270+ const end = ctx .xInterval .offset (start );
271+ tmpArea .width = ctx .xScale (end ) - ctx .xScale (start );
267272 } else {
268273 // Find width to next data point
269274 const index = ctx .flatData .findIndex ((d ) => Number (x (d )) === Number (x (highlightData )));
290295 tmpArea .height = max (yCoord ) - min (yCoord ); // Use first/last values for width
291296 } else if (isScaleBand (ctx .yScale )) {
292297 tmpArea .height = ctx .yScale .step ();
298+ } else if (ctx .yInterval ) {
299+ // y-axis time scale with interval
300+ const start = ctx .yInterval .floor (yValue );
301+ const end = ctx .yInterval .offset (start );
302+ tmpArea .height = ctx .yScale (end ) - ctx .yScale (start );
293303 } else {
294304 // Find width to next data point
295305 const index = ctx .flatData .findIndex ((d ) => Number (y (d )) === Number (y (highlightData )));
Original file line number Diff line number Diff line change 518518 height: ctx .yScale .step (),
519519 data: d ,
520520 };
521+ } else if (ctx .xInterval ) {
522+ // x-axis time scale with interval
523+ const xVal = ctx .x (d );
524+ const start = ctx .xInterval .floor (xVal );
525+ const end = ctx .xInterval .offset (start );
526+
527+ return {
528+ x: ctx .xScale (start ),
529+ y: isScaleBand (ctx .yScale ) ? y - yOffset : min (ctx .yRange ),
530+ width: ctx .xScale (end ) - ctx .xScale (start ),
531+ height: isScaleBand (ctx .yScale ) ? ctx .yScale .step () : fullHeight ,
532+ data: d ,
533+ };
534+ } else if (ctx .yInterval ) {
535+ // y-axis time scale with interval
536+ const yVal = ctx .y (d );
537+ const start = ctx .yInterval .floor (yVal );
538+ const end = ctx .yInterval .offset (start );
539+
540+ return {
541+ x: isScaleBand (ctx .xScale ) ? x - xOffset : min (ctx .xRange ),
542+ y: ctx .yScale (start ),
543+ width: isScaleBand (ctx .xScale ) ? ctx .xScale .step () : fullWidth ,
544+ height: ctx .yScale (end ) - ctx .yScale (start ),
545+ data: d ,
546+ };
521547 } else if (isScaleTime (ctx .xScale )) {
522548 // Find width to next data point
523549 const index = ctx .flatData .findIndex (
You can’t perform that action at this time.
0 commit comments