Skip to content

Commit

Permalink
Merge from latest
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlandsman committed May 16, 2022
2 parents a9feb92 + 3cf0d4a commit 490dada
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
11 changes: 10 additions & 1 deletion charts-packages/ag-charts-community/src/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,25 @@ export class Axis<S extends Scale<D, number>, D = any> {

const groupSelection = update.merge(enter);

let anyVisible = false;
groupSelection
.attrFn('translationY', function (_, datum) {
return Math.round(scale.convert(datum) + halfBandwidth);
})
.attrFn('visible', function (node) {
const min = Math.floor(requestedRangeMin);
const max = Math.ceil(requestedRangeMax);
return (min !== max) && node.translationY >= min && node.translationY <= max;
const visible = (min !== max) && node.translationY >= min && node.translationY <= max;
anyVisible = visible || anyVisible;
return visible;
});

this.group.visible = anyVisible;
if (!anyVisible) {
this.groupSelection = groupSelection;
return;
}

// `ticks instanceof NumericTicks` doesn't work here, so we feature detect.
this.fractionDigits = (ticks as any).fractionDigits >= 0 ? (ticks as any).fractionDigits : 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export class ScatterSeries extends CartesianSeries {
private nodeData: ScatterNodeDatum[] = [];
private markerSelection: Selection<Marker, Group, ScatterNodeDatum, any> = Selection.select(this.pickGroup).selectAll<Marker>();

private labelData: MeasuredLabel[] = [];
private labelSelection: Selection<Text, Group, PlacedLabel, any> = Selection.select(this.group).selectAll<Text>();

readonly marker = new CartesianSeriesMarker();
Expand Down Expand Up @@ -210,16 +209,6 @@ export class ScatterSeries extends CartesianSeries {

this.sizeData = sizeKey ? this.validData.map((d) => d[sizeKey]) : [];

const font = label.getFont();
this.labelData = labelKey ? this.validData.map((d) => {
const text = String(d[labelKey]);
const size = HdpiCanvas.getTextSize(text, font);
return {
text,
...size
};
}) : [];

this.sizeScale.domain = marker.domain ? marker.domain : extent(this.sizeData, isContinuous) || [1, 1];
if (xAxis.scale instanceof ContinuousScale) {
this.xDomain = this.fixNumericExtent(extent(this.xData, isContinuous), 'x', xAxis);
Expand Down Expand Up @@ -264,7 +253,7 @@ export class ScatterSeries extends CartesianSeries {
}

createNodeData(): ScatterNodeDatum[] {
const { chart, data, visible, xAxis, yAxis } = this;
const { chart, data, visible, xAxis, yAxis, label, labelKey } = this;

if (!(chart && data && visible && xAxis && yAxis) || chart.layoutPending || chart.dataPending) {
return [];
Expand All @@ -281,6 +270,7 @@ export class ScatterSeries extends CartesianSeries {

sizeScale.range = [marker.size, marker.maxSize];

const font = label.getFont();
for (let i = 0; i < xData.length; i++) {
const xy = this.checkDomainXY(xData[i], yData[i], isContinuousX, isContinuousY);

Expand All @@ -295,12 +285,18 @@ export class ScatterSeries extends CartesianSeries {
continue;
}

const text = labelKey ? String(validData[i][labelKey]) : '';
const size = HdpiCanvas.getTextSize(text, font);

nodeData.push({
series: this,
datum: validData[i],
point: { x, y },
size: sizeData.length ? sizeScale.convert(sizeData[i]) : marker.size,
label: this.labelData[i]
label: {
text,
...size,
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ When both range selection and row selection are enabled, the default behaviour o
In this mode, when multiple cells are selected via range selection, the cell range is copied and not the selected rows. This behaviour is not enabled by default since it can be confusing for the copy behaviour to change depending on how much is selected.

The below example has range selection, row selection and `suppressCopySingleCellRanges` enabled.
Observe that if only a single cell is selected, the row is copied, otherwise the range is copied.
- Select a range by clicking & dragging on a cell.
- Copy with <kbd>Ctrl</kbd>+<kbd>C</kbd>, paste into a text editor, observe that the range was copied.
- Deselect this range by clicking on any cell
- Select one or more rows by moving focus with the arrow keys and pressing the <kbd>SPACE</kbd> key to toggle the row's selection.
- Copy with <kbd>Ctrl</kbd>+<kbd>C</kbd>, paste into a text editor and observe that the rows were copied.

<grid-example title='Copying Mixed Ranges & Rows' name='copy-mixed' type='generated' options='{ "enterprise": true, "modules": ["clientside", "menu", "range", "clipboard"] }'></grid-example>

Expand Down

0 comments on commit 490dada

Please sign in to comment.