Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-charting): use legend data and config from Legends component for image export #33847

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update measurement span
  • Loading branch information
krkshitij committed Feb 18, 2025
commit 4d2856f4166c183e909f991030f45ab23a73d1f6
8 changes: 5 additions & 3 deletions packages/charts/react-charting/src/utilities/utilities.ts
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ import {
IHorizontalBarChartWithAxisDataPoint,
} from '../index';
import { formatPrefix as d3FormatPrefix } from 'd3-format';
import { getId } from '@fluentui/react';

export type NumericAxis = D3Axis<number | { valueOf(): number }>;
export type StringAxis = D3Axis<string>;
@@ -1467,16 +1468,17 @@ export function copyStyle(properties: string[] | Record<string, string>, fromEl:
}
}

const SPAN_STYLE = {
const MEASUREMENT_SPAN_STYLE = {
position: 'absolute',
visibility: 'hidden',
top: '-20000px',
left: 0,
padding: 0,
margin: 0,
border: 'none',
whiteSpace: 'pre',
};
const MEASUREMENT_SPAN_ID = 'measurement_span';
const MEASUREMENT_SPAN_ID = getId('measurement_span_');

export const createMeasurementSpan = (text: string | number, className: string) => {
let measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
@@ -1487,8 +1489,8 @@ export const createMeasurementSpan = (text: string | number, className: string)
document.body.appendChild(measurementSpan);
}

Object.assign(measurementSpan.style, SPAN_STYLE);
measurementSpan.setAttribute('class', className);
Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
measurementSpan.textContent = `${text}`;

return measurementSpan;
Loading
Oops, something went wrong.