@corva/ui 3.58.0-0 → 3.58.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -196,6 +196,8 @@ const createNoopMetricsClient = () => ({
196
196
  recordToolInvocation: () => { },
197
197
  recordToolError: () => { },
198
198
  recordToolEmptyResult: () => { },
199
+ recordPromptInvocation: () => { },
200
+ recordPromptError: () => { },
199
201
  recordSession: () => { },
200
202
  recordSessionEnd: () => { },
201
203
  });
@@ -226,9 +228,9 @@ const validateDsn = (dsn) => {
226
228
  return url.href;
227
229
  };
228
230
 
229
- const MCP_SERVER_VERSION = '1.1.0';
231
+ const MCP_SERVER_VERSION = '1.2.0';
230
232
 
231
- var version = "3.58.0-0";
233
+ var version = "3.58.0-2";
232
234
 
233
235
  const CORVA_UI_VERSION = version;
234
236
 
@@ -242,8 +244,14 @@ const createMetricsClient = (meter) => {
242
244
  const emptyResultCounter = meter.createCounter('mcp.server.tool.empty_results', {
243
245
  description: 'Number of tool invocations returning empty results',
244
246
  });
247
+ const promptInvocationCounter = meter.createCounter('mcp.server.prompt.invocations', {
248
+ description: 'Number of prompt invocations',
249
+ });
250
+ const promptErrorCounter = meter.createCounter('mcp.server.prompt.errors', {
251
+ description: 'Number of prompt invocation errors',
252
+ });
245
253
  const operationDuration = meter.createHistogram('mcp.server.operation.duration', {
246
- description: 'Duration of tool operations in milliseconds',
254
+ description: 'Duration of MCP operations (tool and prompt calls) in milliseconds',
247
255
  unit: 'ms',
248
256
  });
249
257
  const sessionCounter = meter.createCounter('mcp.server.sessions', {
@@ -258,8 +266,9 @@ const createMetricsClient = (meter) => {
258
266
  });
259
267
  return {
260
268
  recordToolInvocation: (toolName, durationMs) => {
269
+ const attrs = { 'gen_ai.tool.name': toolName, 'mcp.method.name': 'tools/call' };
261
270
  invocationCounter.add(1, { 'gen_ai.tool.name': toolName });
262
- operationDuration.record(durationMs, { 'gen_ai.tool.name': toolName });
271
+ operationDuration.record(durationMs, attrs);
263
272
  errorCounter.add(0, { 'gen_ai.tool.name': toolName });
264
273
  emptyResultCounter.add(0, { 'gen_ai.tool.name': toolName });
265
274
  },
@@ -269,6 +278,15 @@ const createMetricsClient = (meter) => {
269
278
  recordToolEmptyResult: toolName => {
270
279
  emptyResultCounter.add(1, { 'gen_ai.tool.name': toolName });
271
280
  },
281
+ recordPromptInvocation: (promptName, durationMs) => {
282
+ const attrs = { 'gen_ai.prompt.name': promptName, 'mcp.method.name': 'prompts/get' };
283
+ promptInvocationCounter.add(1, { 'gen_ai.prompt.name': promptName });
284
+ operationDuration.record(durationMs, attrs);
285
+ promptErrorCounter.add(0, { 'gen_ai.prompt.name': promptName });
286
+ },
287
+ recordPromptError: (promptName, errorType) => {
288
+ promptErrorCounter.add(1, { 'gen_ai.prompt.name': promptName, 'error.type': errorType });
289
+ },
272
290
  recordSession: (clientName, clientVersion, projectIdentity) => {
273
291
  sessionCounter.add(1, {
274
292
  'mcp.client.name': clientName || UNKNOWN_CLIENT_ATTR,
@@ -314,6 +332,7 @@ const createNoopTelemetryClient = () => ({
314
332
  sessionId: '',
315
333
  metrics: createNoopMetricsClient(),
316
334
  recordToolCall: () => { },
335
+ recordPromptCall: () => { },
317
336
  recordInitialize: () => { },
318
337
  shutdown: async () => { },
319
338
  });
@@ -360,6 +379,49 @@ const recordToolSpan = (tracer, attrs) => {
360
379
  }
361
380
  };
362
381
 
382
+ const recordPromptSpan = (tracer, attrs) => {
383
+ if (!tracer) {
384
+ return;
385
+ }
386
+ const span = tracer.startSpan(`prompts/get ${attrs.promptName}`, { kind: SpanKind.SERVER, startTime: attrs.startTime }, attrs.parentContext);
387
+ try {
388
+ span.setAttributes({
389
+ 'gen_ai.prompt.name': attrs.promptName,
390
+ 'gen_ai.operation.name': 'execute_prompt',
391
+ 'mcp.method.name': 'prompts/get',
392
+ 'corva.mcp.prompt.arguments': attrs.args,
393
+ 'corva.mcp.prompt.result_size_bytes': attrs.resultSizeBytes,
394
+ 'corva.mcp.prompt.message_count': attrs.messageCount,
395
+ });
396
+ span.setAttribute('mcp.client.name', attrs.clientName || UNKNOWN_CLIENT_ATTR);
397
+ span.setAttribute('mcp.client.version', attrs.clientVersion || UNKNOWN_CLIENT_ATTR);
398
+ if (attrs.sessionId) {
399
+ span.setAttribute('mcp.session.id', attrs.sessionId);
400
+ }
401
+ if (attrs.protocolVersion) {
402
+ span.setAttribute('mcp.protocol.version', attrs.protocolVersion);
403
+ }
404
+ if (attrs.networkTransport) {
405
+ span.setAttribute('network.transport', attrs.networkTransport);
406
+ }
407
+ if (attrs.requestId !== undefined) {
408
+ span.setAttribute('jsonrpc.request.id', String(attrs.requestId));
409
+ }
410
+ if (attrs.extraAttrs) {
411
+ span.setAttributes(attrs.extraAttrs);
412
+ }
413
+ if (attrs.isError) {
414
+ if (attrs.errorType) {
415
+ span.setAttribute('error.type', attrs.errorType);
416
+ }
417
+ span.setStatus({ code: SpanStatusCode.ERROR });
418
+ }
419
+ }
420
+ finally {
421
+ span.end(attrs.endTime);
422
+ }
423
+ };
424
+
363
425
  const recordInitSpan = (tracer, attrs) => {
364
426
  if (!tracer) {
365
427
  return;
@@ -423,6 +485,12 @@ const createTelemetryResource = () => new Resource({
423
485
 
424
486
  const createTracerTelemetryClient = (tracer, sessionId, metrics, providerShutdown, logger) => {
425
487
  let hasLoggedSpanFailure = false;
488
+ const warnOnce = () => {
489
+ if (!hasLoggedSpanFailure) {
490
+ logger.warn('Telemetry span recording failed, continuing without telemetry');
491
+ hasLoggedSpanFailure = true;
492
+ }
493
+ };
426
494
  return {
427
495
  isEnabled: () => true,
428
496
  sessionId,
@@ -432,10 +500,15 @@ const createTracerTelemetryClient = (tracer, sessionId, metrics, providerShutdow
432
500
  recordToolSpan(tracer, attrs);
433
501
  }
434
502
  catch {
435
- if (!hasLoggedSpanFailure) {
436
- logger.warn('Telemetry span recording failed, continuing without telemetry');
437
- hasLoggedSpanFailure = true;
438
- }
503
+ warnOnce();
504
+ }
505
+ },
506
+ recordPromptCall: attrs => {
507
+ try {
508
+ recordPromptSpan(tracer, attrs);
509
+ }
510
+ catch {
511
+ warnOnce();
439
512
  }
440
513
  },
441
514
  recordInitialize: attrs => {
@@ -443,10 +516,7 @@ const createTracerTelemetryClient = (tracer, sessionId, metrics, providerShutdow
443
516
  recordInitSpan(tracer, attrs);
444
517
  }
445
518
  catch {
446
- if (!hasLoggedSpanFailure) {
447
- logger.warn('Telemetry span recording failed, continuing without telemetry');
448
- hasLoggedSpanFailure = true;
449
- }
519
+ warnOnce();
450
520
  }
451
521
  },
452
522
  shutdown: async () => {
@@ -672,6 +742,19 @@ const serializeToolError = (error) => {
672
742
  };
673
743
  };
674
744
 
745
+ const serializePromptResult = (result) => {
746
+ let sizeBytes = 0;
747
+ for (const message of result.messages) {
748
+ if (message.content.type === 'text') {
749
+ sizeBytes += Buffer.byteLength(message.content.text, 'utf8');
750
+ }
751
+ }
752
+ return {
753
+ sizeBytes,
754
+ messageCount: result.messages.length,
755
+ };
756
+ };
757
+
675
758
  const metaGetter = {
676
759
  keys: carrier => Object.keys(carrier),
677
760
  get: (carrier, key) => {
@@ -683,11 +766,7 @@ const extractContextFromMeta = (meta) => {
683
766
  if (!meta || typeof meta !== 'object') {
684
767
  return undefined;
685
768
  }
686
- const bag = meta;
687
- if (!bag.traceparent || typeof bag.traceparent !== 'string') {
688
- return undefined;
689
- }
690
- return propagation.extract(context.active(), bag, metaGetter);
769
+ return propagation.extract(context.active(), meta, metaGetter);
691
770
  };
692
771
 
693
772
  const SEARCH_CONFIG = {
@@ -9005,6 +9084,1374 @@ var componentsV1Data = [
9005
9084
  "casing"
9006
9085
  ]
9007
9086
  },
9087
+ {
9088
+ name: "ChartButton",
9089
+ modulePath: "components/Chart/components/ChartButton",
9090
+ importPath: "@corva/ui/components",
9091
+ category: "v1",
9092
+ description: "ChartButton — chart button for the Chart family. See the Chart story for canonical usage.",
9093
+ isExperimental: false,
9094
+ isDeprecated: false,
9095
+ props: [
9096
+ ],
9097
+ examples: [
9098
+ {
9099
+ name: "Chart",
9100
+ description: "",
9101
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9102
+ },
9103
+ {
9104
+ name: "AxisConfigRegularSpacing",
9105
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9106
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9107
+ },
9108
+ {
9109
+ name: "AxisConfigDenseSpacing",
9110
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9111
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9112
+ },
9113
+ {
9114
+ name: "ChartsWithDropdownAxes",
9115
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9116
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9117
+ },
9118
+ {
9119
+ name: "MultipleAxesChart",
9120
+ description: "",
9121
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9122
+ },
9123
+ {
9124
+ name: "CustomizeScaleChart",
9125
+ description: "",
9126
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9127
+ },
9128
+ {
9129
+ name: "CustomizeScaleChartInverted",
9130
+ description: "",
9131
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9132
+ },
9133
+ {
9134
+ name: "ChartWithFormations",
9135
+ description: "",
9136
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9137
+ },
9138
+ {
9139
+ name: "AdditionalButtonsChart",
9140
+ description: "",
9141
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9142
+ },
9143
+ {
9144
+ name: "BarChart",
9145
+ description: "",
9146
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9147
+ },
9148
+ {
9149
+ name: "StackedBarChart",
9150
+ description: "",
9151
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9152
+ },
9153
+ {
9154
+ name: "SmallChart",
9155
+ description: "",
9156
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9157
+ },
9158
+ {
9159
+ name: "AxisDropdownChart",
9160
+ description: "",
9161
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9162
+ },
9163
+ {
9164
+ name: "ChartRightAxis",
9165
+ description: "",
9166
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9167
+ },
9168
+ {
9169
+ name: "ChartTwoValuesAxis",
9170
+ description: "",
9171
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9172
+ },
9173
+ {
9174
+ name: "MobileResponsiveChart",
9175
+ description: "",
9176
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9177
+ },
9178
+ {
9179
+ name: "HighchartStockChart",
9180
+ description: "",
9181
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9182
+ },
9183
+ {
9184
+ name: "DonutChart",
9185
+ description: "",
9186
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9187
+ }
9188
+ ],
9189
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/ChartButton.js",
9190
+ keywords: [
9191
+ "chartbutton",
9192
+ "chart",
9193
+ "button",
9194
+ "family.",
9195
+ "story",
9196
+ "canonical",
9197
+ "usage."
9198
+ ]
9199
+ },
9200
+ {
9201
+ name: "ChartButtons",
9202
+ modulePath: "components/Chart/components/ChartButtons",
9203
+ importPath: "@corva/ui/components",
9204
+ category: "v1",
9205
+ description: "ChartButtons — chart buttons for the Chart family. See the Chart story for canonical usage.",
9206
+ isExperimental: false,
9207
+ isDeprecated: false,
9208
+ props: [
9209
+ ],
9210
+ examples: [
9211
+ {
9212
+ name: "Chart",
9213
+ description: "",
9214
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9215
+ },
9216
+ {
9217
+ name: "AxisConfigRegularSpacing",
9218
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9219
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9220
+ },
9221
+ {
9222
+ name: "AxisConfigDenseSpacing",
9223
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9224
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9225
+ },
9226
+ {
9227
+ name: "ChartsWithDropdownAxes",
9228
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9229
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9230
+ },
9231
+ {
9232
+ name: "MultipleAxesChart",
9233
+ description: "",
9234
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9235
+ },
9236
+ {
9237
+ name: "CustomizeScaleChart",
9238
+ description: "",
9239
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9240
+ },
9241
+ {
9242
+ name: "CustomizeScaleChartInverted",
9243
+ description: "",
9244
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9245
+ },
9246
+ {
9247
+ name: "ChartWithFormations",
9248
+ description: "",
9249
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9250
+ },
9251
+ {
9252
+ name: "AdditionalButtonsChart",
9253
+ description: "",
9254
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9255
+ },
9256
+ {
9257
+ name: "BarChart",
9258
+ description: "",
9259
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9260
+ },
9261
+ {
9262
+ name: "StackedBarChart",
9263
+ description: "",
9264
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9265
+ },
9266
+ {
9267
+ name: "SmallChart",
9268
+ description: "",
9269
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9270
+ },
9271
+ {
9272
+ name: "AxisDropdownChart",
9273
+ description: "",
9274
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9275
+ },
9276
+ {
9277
+ name: "ChartRightAxis",
9278
+ description: "",
9279
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9280
+ },
9281
+ {
9282
+ name: "ChartTwoValuesAxis",
9283
+ description: "",
9284
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9285
+ },
9286
+ {
9287
+ name: "MobileResponsiveChart",
9288
+ description: "",
9289
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9290
+ },
9291
+ {
9292
+ name: "HighchartStockChart",
9293
+ description: "",
9294
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9295
+ },
9296
+ {
9297
+ name: "DonutChart",
9298
+ description: "",
9299
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9300
+ }
9301
+ ],
9302
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/ChartButtons.js",
9303
+ keywords: [
9304
+ "chartbuttons",
9305
+ "chart",
9306
+ "buttons",
9307
+ "family.",
9308
+ "story",
9309
+ "canonical",
9310
+ "usage."
9311
+ ]
9312
+ },
9313
+ {
9314
+ name: "ChartWrapper",
9315
+ modulePath: "components/Chart/components/ChartWrapper",
9316
+ importPath: "@corva/ui/components",
9317
+ category: "v1",
9318
+ description: "ChartWrapper — chart wrapper for the Chart family. See the Chart story for canonical usage.",
9319
+ isExperimental: false,
9320
+ isDeprecated: false,
9321
+ props: [
9322
+ ],
9323
+ examples: [
9324
+ {
9325
+ name: "Chart",
9326
+ description: "",
9327
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9328
+ },
9329
+ {
9330
+ name: "AxisConfigRegularSpacing",
9331
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9332
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9333
+ },
9334
+ {
9335
+ name: "AxisConfigDenseSpacing",
9336
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9337
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9338
+ },
9339
+ {
9340
+ name: "ChartsWithDropdownAxes",
9341
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9342
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9343
+ },
9344
+ {
9345
+ name: "MultipleAxesChart",
9346
+ description: "",
9347
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9348
+ },
9349
+ {
9350
+ name: "CustomizeScaleChart",
9351
+ description: "",
9352
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9353
+ },
9354
+ {
9355
+ name: "CustomizeScaleChartInverted",
9356
+ description: "",
9357
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9358
+ },
9359
+ {
9360
+ name: "ChartWithFormations",
9361
+ description: "",
9362
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9363
+ },
9364
+ {
9365
+ name: "AdditionalButtonsChart",
9366
+ description: "",
9367
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9368
+ },
9369
+ {
9370
+ name: "BarChart",
9371
+ description: "",
9372
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9373
+ },
9374
+ {
9375
+ name: "StackedBarChart",
9376
+ description: "",
9377
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9378
+ },
9379
+ {
9380
+ name: "SmallChart",
9381
+ description: "",
9382
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9383
+ },
9384
+ {
9385
+ name: "AxisDropdownChart",
9386
+ description: "",
9387
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9388
+ },
9389
+ {
9390
+ name: "ChartRightAxis",
9391
+ description: "",
9392
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9393
+ },
9394
+ {
9395
+ name: "ChartTwoValuesAxis",
9396
+ description: "",
9397
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9398
+ },
9399
+ {
9400
+ name: "MobileResponsiveChart",
9401
+ description: "",
9402
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9403
+ },
9404
+ {
9405
+ name: "HighchartStockChart",
9406
+ description: "",
9407
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9408
+ },
9409
+ {
9410
+ name: "DonutChart",
9411
+ description: "",
9412
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9413
+ }
9414
+ ],
9415
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/ChartWrapper.js",
9416
+ keywords: [
9417
+ "chartwrapper",
9418
+ "chart",
9419
+ "wrapper",
9420
+ "family.",
9421
+ "story",
9422
+ "canonical",
9423
+ "usage."
9424
+ ]
9425
+ },
9426
+ {
9427
+ name: "AxisDropdown",
9428
+ modulePath: "components/Chart/components/AxisDropdown",
9429
+ importPath: "@corva/ui/components",
9430
+ category: "v1",
9431
+ description: "AxisDropdown — axis dropdown for the Chart family. See the Chart story for canonical usage.",
9432
+ isExperimental: false,
9433
+ isDeprecated: false,
9434
+ props: [
9435
+ ],
9436
+ examples: [
9437
+ {
9438
+ name: "Chart",
9439
+ description: "",
9440
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9441
+ },
9442
+ {
9443
+ name: "AxisConfigRegularSpacing",
9444
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9445
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9446
+ },
9447
+ {
9448
+ name: "AxisConfigDenseSpacing",
9449
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9450
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9451
+ },
9452
+ {
9453
+ name: "ChartsWithDropdownAxes",
9454
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9455
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9456
+ },
9457
+ {
9458
+ name: "MultipleAxesChart",
9459
+ description: "",
9460
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9461
+ },
9462
+ {
9463
+ name: "CustomizeScaleChart",
9464
+ description: "",
9465
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9466
+ },
9467
+ {
9468
+ name: "CustomizeScaleChartInverted",
9469
+ description: "",
9470
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9471
+ },
9472
+ {
9473
+ name: "ChartWithFormations",
9474
+ description: "",
9475
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9476
+ },
9477
+ {
9478
+ name: "AdditionalButtonsChart",
9479
+ description: "",
9480
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9481
+ },
9482
+ {
9483
+ name: "BarChart",
9484
+ description: "",
9485
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9486
+ },
9487
+ {
9488
+ name: "StackedBarChart",
9489
+ description: "",
9490
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9491
+ },
9492
+ {
9493
+ name: "SmallChart",
9494
+ description: "",
9495
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9496
+ },
9497
+ {
9498
+ name: "AxisDropdownChart",
9499
+ description: "",
9500
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9501
+ },
9502
+ {
9503
+ name: "ChartRightAxis",
9504
+ description: "",
9505
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9506
+ },
9507
+ {
9508
+ name: "ChartTwoValuesAxis",
9509
+ description: "",
9510
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9511
+ },
9512
+ {
9513
+ name: "MobileResponsiveChart",
9514
+ description: "",
9515
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9516
+ },
9517
+ {
9518
+ name: "HighchartStockChart",
9519
+ description: "",
9520
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9521
+ },
9522
+ {
9523
+ name: "DonutChart",
9524
+ description: "",
9525
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9526
+ }
9527
+ ],
9528
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/AxisDropdown.js",
9529
+ keywords: [
9530
+ "axisdropdown",
9531
+ "axis",
9532
+ "dropdown",
9533
+ "chart",
9534
+ "family.",
9535
+ "story",
9536
+ "canonical",
9537
+ "usage."
9538
+ ]
9539
+ },
9540
+ {
9541
+ name: "ChartSelect",
9542
+ modulePath: "components/Chart/components/ChartSelect",
9543
+ importPath: "@corva/ui/components",
9544
+ category: "v1",
9545
+ description: "ChartSelect — chart select for the Chart family. See the Chart story for canonical usage.",
9546
+ isExperimental: false,
9547
+ isDeprecated: false,
9548
+ props: [
9549
+ ],
9550
+ examples: [
9551
+ {
9552
+ name: "Chart",
9553
+ description: "",
9554
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9555
+ },
9556
+ {
9557
+ name: "AxisConfigRegularSpacing",
9558
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9559
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9560
+ },
9561
+ {
9562
+ name: "AxisConfigDenseSpacing",
9563
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9564
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9565
+ },
9566
+ {
9567
+ name: "ChartsWithDropdownAxes",
9568
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9569
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9570
+ },
9571
+ {
9572
+ name: "MultipleAxesChart",
9573
+ description: "",
9574
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9575
+ },
9576
+ {
9577
+ name: "CustomizeScaleChart",
9578
+ description: "",
9579
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9580
+ },
9581
+ {
9582
+ name: "CustomizeScaleChartInverted",
9583
+ description: "",
9584
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9585
+ },
9586
+ {
9587
+ name: "ChartWithFormations",
9588
+ description: "",
9589
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9590
+ },
9591
+ {
9592
+ name: "AdditionalButtonsChart",
9593
+ description: "",
9594
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9595
+ },
9596
+ {
9597
+ name: "BarChart",
9598
+ description: "",
9599
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9600
+ },
9601
+ {
9602
+ name: "StackedBarChart",
9603
+ description: "",
9604
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9605
+ },
9606
+ {
9607
+ name: "SmallChart",
9608
+ description: "",
9609
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9610
+ },
9611
+ {
9612
+ name: "AxisDropdownChart",
9613
+ description: "",
9614
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9615
+ },
9616
+ {
9617
+ name: "ChartRightAxis",
9618
+ description: "",
9619
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9620
+ },
9621
+ {
9622
+ name: "ChartTwoValuesAxis",
9623
+ description: "",
9624
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9625
+ },
9626
+ {
9627
+ name: "MobileResponsiveChart",
9628
+ description: "",
9629
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9630
+ },
9631
+ {
9632
+ name: "HighchartStockChart",
9633
+ description: "",
9634
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9635
+ },
9636
+ {
9637
+ name: "DonutChart",
9638
+ description: "",
9639
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9640
+ }
9641
+ ],
9642
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/ChartSelect.js",
9643
+ keywords: [
9644
+ "chartselect",
9645
+ "chart",
9646
+ "select",
9647
+ "family.",
9648
+ "story",
9649
+ "canonical",
9650
+ "usage."
9651
+ ]
9652
+ },
9653
+ {
9654
+ name: "DragToZoomButton",
9655
+ modulePath: "components/Chart/components/buttons/DragToZoomButton",
9656
+ importPath: "@corva/ui/components",
9657
+ category: "v1",
9658
+ description: "DragToZoomButton — drag to zoom button for the Chart family. See the Chart story for canonical usage.",
9659
+ isExperimental: false,
9660
+ isDeprecated: false,
9661
+ props: [
9662
+ ],
9663
+ examples: [
9664
+ {
9665
+ name: "Chart",
9666
+ description: "",
9667
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9668
+ },
9669
+ {
9670
+ name: "AxisConfigRegularSpacing",
9671
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9672
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9673
+ },
9674
+ {
9675
+ name: "AxisConfigDenseSpacing",
9676
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9677
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9678
+ },
9679
+ {
9680
+ name: "ChartsWithDropdownAxes",
9681
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9682
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9683
+ },
9684
+ {
9685
+ name: "MultipleAxesChart",
9686
+ description: "",
9687
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9688
+ },
9689
+ {
9690
+ name: "CustomizeScaleChart",
9691
+ description: "",
9692
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9693
+ },
9694
+ {
9695
+ name: "CustomizeScaleChartInverted",
9696
+ description: "",
9697
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9698
+ },
9699
+ {
9700
+ name: "ChartWithFormations",
9701
+ description: "",
9702
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9703
+ },
9704
+ {
9705
+ name: "AdditionalButtonsChart",
9706
+ description: "",
9707
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9708
+ },
9709
+ {
9710
+ name: "BarChart",
9711
+ description: "",
9712
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9713
+ },
9714
+ {
9715
+ name: "StackedBarChart",
9716
+ description: "",
9717
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9718
+ },
9719
+ {
9720
+ name: "SmallChart",
9721
+ description: "",
9722
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9723
+ },
9724
+ {
9725
+ name: "AxisDropdownChart",
9726
+ description: "",
9727
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9728
+ },
9729
+ {
9730
+ name: "ChartRightAxis",
9731
+ description: "",
9732
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9733
+ },
9734
+ {
9735
+ name: "ChartTwoValuesAxis",
9736
+ description: "",
9737
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9738
+ },
9739
+ {
9740
+ name: "MobileResponsiveChart",
9741
+ description: "",
9742
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9743
+ },
9744
+ {
9745
+ name: "HighchartStockChart",
9746
+ description: "",
9747
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9748
+ },
9749
+ {
9750
+ name: "DonutChart",
9751
+ description: "",
9752
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9753
+ }
9754
+ ],
9755
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/DragToZoomButton.js",
9756
+ keywords: [
9757
+ "dragtozoombutton",
9758
+ "drag",
9759
+ "zoom",
9760
+ "button",
9761
+ "chart",
9762
+ "family.",
9763
+ "story",
9764
+ "canonical",
9765
+ "usage."
9766
+ ]
9767
+ },
9768
+ {
9769
+ name: "ZoomInButton",
9770
+ modulePath: "components/Chart/components/buttons/ZoomInButton",
9771
+ importPath: "@corva/ui/components",
9772
+ category: "v1",
9773
+ description: "ZoomInButton — zoom in button for the Chart family. See the Chart story for canonical usage.",
9774
+ isExperimental: false,
9775
+ isDeprecated: false,
9776
+ props: [
9777
+ ],
9778
+ examples: [
9779
+ {
9780
+ name: "Chart",
9781
+ description: "",
9782
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9783
+ },
9784
+ {
9785
+ name: "AxisConfigRegularSpacing",
9786
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9787
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9788
+ },
9789
+ {
9790
+ name: "AxisConfigDenseSpacing",
9791
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9792
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9793
+ },
9794
+ {
9795
+ name: "ChartsWithDropdownAxes",
9796
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9797
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9798
+ },
9799
+ {
9800
+ name: "MultipleAxesChart",
9801
+ description: "",
9802
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9803
+ },
9804
+ {
9805
+ name: "CustomizeScaleChart",
9806
+ description: "",
9807
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9808
+ },
9809
+ {
9810
+ name: "CustomizeScaleChartInverted",
9811
+ description: "",
9812
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9813
+ },
9814
+ {
9815
+ name: "ChartWithFormations",
9816
+ description: "",
9817
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9818
+ },
9819
+ {
9820
+ name: "AdditionalButtonsChart",
9821
+ description: "",
9822
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9823
+ },
9824
+ {
9825
+ name: "BarChart",
9826
+ description: "",
9827
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9828
+ },
9829
+ {
9830
+ name: "StackedBarChart",
9831
+ description: "",
9832
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9833
+ },
9834
+ {
9835
+ name: "SmallChart",
9836
+ description: "",
9837
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9838
+ },
9839
+ {
9840
+ name: "AxisDropdownChart",
9841
+ description: "",
9842
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9843
+ },
9844
+ {
9845
+ name: "ChartRightAxis",
9846
+ description: "",
9847
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9848
+ },
9849
+ {
9850
+ name: "ChartTwoValuesAxis",
9851
+ description: "",
9852
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9853
+ },
9854
+ {
9855
+ name: "MobileResponsiveChart",
9856
+ description: "",
9857
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9858
+ },
9859
+ {
9860
+ name: "HighchartStockChart",
9861
+ description: "",
9862
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9863
+ },
9864
+ {
9865
+ name: "DonutChart",
9866
+ description: "",
9867
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9868
+ }
9869
+ ],
9870
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ZoomInButton.js",
9871
+ keywords: [
9872
+ "zoominbutton",
9873
+ "zoom",
9874
+ "button",
9875
+ "chart",
9876
+ "family.",
9877
+ "story",
9878
+ "canonical",
9879
+ "usage."
9880
+ ]
9881
+ },
9882
+ {
9883
+ name: "ZoomOutButton",
9884
+ modulePath: "components/Chart/components/buttons/ZoomOutButton",
9885
+ importPath: "@corva/ui/components",
9886
+ category: "v1",
9887
+ description: "ZoomOutButton — zoom out button for the Chart family. See the Chart story for canonical usage.",
9888
+ isExperimental: false,
9889
+ isDeprecated: false,
9890
+ props: [
9891
+ ],
9892
+ examples: [
9893
+ {
9894
+ name: "Chart",
9895
+ description: "",
9896
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9897
+ },
9898
+ {
9899
+ name: "AxisConfigRegularSpacing",
9900
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9901
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
9902
+ },
9903
+ {
9904
+ name: "AxisConfigDenseSpacing",
9905
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
9906
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
9907
+ },
9908
+ {
9909
+ name: "ChartsWithDropdownAxes",
9910
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
9911
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
9912
+ },
9913
+ {
9914
+ name: "MultipleAxesChart",
9915
+ description: "",
9916
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
9917
+ },
9918
+ {
9919
+ name: "CustomizeScaleChart",
9920
+ description: "",
9921
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
9922
+ },
9923
+ {
9924
+ name: "CustomizeScaleChartInverted",
9925
+ description: "",
9926
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
9927
+ },
9928
+ {
9929
+ name: "ChartWithFormations",
9930
+ description: "",
9931
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
9932
+ },
9933
+ {
9934
+ name: "AdditionalButtonsChart",
9935
+ description: "",
9936
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
9937
+ },
9938
+ {
9939
+ name: "BarChart",
9940
+ description: "",
9941
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
9942
+ },
9943
+ {
9944
+ name: "StackedBarChart",
9945
+ description: "",
9946
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
9947
+ },
9948
+ {
9949
+ name: "SmallChart",
9950
+ description: "",
9951
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
9952
+ },
9953
+ {
9954
+ name: "AxisDropdownChart",
9955
+ description: "",
9956
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
9957
+ },
9958
+ {
9959
+ name: "ChartRightAxis",
9960
+ description: "",
9961
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
9962
+ },
9963
+ {
9964
+ name: "ChartTwoValuesAxis",
9965
+ description: "",
9966
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
9967
+ },
9968
+ {
9969
+ name: "MobileResponsiveChart",
9970
+ description: "",
9971
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
9972
+ },
9973
+ {
9974
+ name: "HighchartStockChart",
9975
+ description: "",
9976
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
9977
+ },
9978
+ {
9979
+ name: "DonutChart",
9980
+ description: "",
9981
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
9982
+ }
9983
+ ],
9984
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ZoomOutButton.js",
9985
+ keywords: [
9986
+ "zoomoutbutton",
9987
+ "zoom",
9988
+ "button",
9989
+ "chart",
9990
+ "family.",
9991
+ "story",
9992
+ "canonical",
9993
+ "usage.",
9994
+ "out"
9995
+ ]
9996
+ },
9997
+ {
9998
+ name: "PanButton",
9999
+ modulePath: "components/Chart/components/buttons/PanButton",
10000
+ importPath: "@corva/ui/components",
10001
+ category: "v1",
10002
+ description: "PanButton — pan button for the Chart family. See the Chart story for canonical usage.",
10003
+ isExperimental: false,
10004
+ isDeprecated: false,
10005
+ props: [
10006
+ ],
10007
+ examples: [
10008
+ {
10009
+ name: "Chart",
10010
+ description: "",
10011
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10012
+ },
10013
+ {
10014
+ name: "AxisConfigRegularSpacing",
10015
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10016
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
10017
+ },
10018
+ {
10019
+ name: "AxisConfigDenseSpacing",
10020
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10021
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
10022
+ },
10023
+ {
10024
+ name: "ChartsWithDropdownAxes",
10025
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
10026
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
10027
+ },
10028
+ {
10029
+ name: "MultipleAxesChart",
10030
+ description: "",
10031
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
10032
+ },
10033
+ {
10034
+ name: "CustomizeScaleChart",
10035
+ description: "",
10036
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
10037
+ },
10038
+ {
10039
+ name: "CustomizeScaleChartInverted",
10040
+ description: "",
10041
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
10042
+ },
10043
+ {
10044
+ name: "ChartWithFormations",
10045
+ description: "",
10046
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
10047
+ },
10048
+ {
10049
+ name: "AdditionalButtonsChart",
10050
+ description: "",
10051
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
10052
+ },
10053
+ {
10054
+ name: "BarChart",
10055
+ description: "",
10056
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
10057
+ },
10058
+ {
10059
+ name: "StackedBarChart",
10060
+ description: "",
10061
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
10062
+ },
10063
+ {
10064
+ name: "SmallChart",
10065
+ description: "",
10066
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10067
+ },
10068
+ {
10069
+ name: "AxisDropdownChart",
10070
+ description: "",
10071
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
10072
+ },
10073
+ {
10074
+ name: "ChartRightAxis",
10075
+ description: "",
10076
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
10077
+ },
10078
+ {
10079
+ name: "ChartTwoValuesAxis",
10080
+ description: "",
10081
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
10082
+ },
10083
+ {
10084
+ name: "MobileResponsiveChart",
10085
+ description: "",
10086
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
10087
+ },
10088
+ {
10089
+ name: "HighchartStockChart",
10090
+ description: "",
10091
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
10092
+ },
10093
+ {
10094
+ name: "DonutChart",
10095
+ description: "",
10096
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
10097
+ }
10098
+ ],
10099
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/PanButton.js",
10100
+ keywords: [
10101
+ "panbutton",
10102
+ "button",
10103
+ "chart",
10104
+ "family.",
10105
+ "story",
10106
+ "canonical",
10107
+ "usage.",
10108
+ "pan"
10109
+ ]
10110
+ },
10111
+ {
10112
+ name: "ResetZoomButton",
10113
+ modulePath: "components/Chart/components/buttons/ResetZoomButton",
10114
+ importPath: "@corva/ui/components",
10115
+ category: "v1",
10116
+ description: "ResetZoomButton — reset zoom button for the Chart family. See the Chart story for canonical usage.",
10117
+ isExperimental: false,
10118
+ isDeprecated: false,
10119
+ props: [
10120
+ ],
10121
+ examples: [
10122
+ {
10123
+ name: "Chart",
10124
+ description: "",
10125
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10126
+ },
10127
+ {
10128
+ name: "AxisConfigRegularSpacing",
10129
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10130
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
10131
+ },
10132
+ {
10133
+ name: "AxisConfigDenseSpacing",
10134
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10135
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
10136
+ },
10137
+ {
10138
+ name: "ChartsWithDropdownAxes",
10139
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
10140
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
10141
+ },
10142
+ {
10143
+ name: "MultipleAxesChart",
10144
+ description: "",
10145
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
10146
+ },
10147
+ {
10148
+ name: "CustomizeScaleChart",
10149
+ description: "",
10150
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
10151
+ },
10152
+ {
10153
+ name: "CustomizeScaleChartInverted",
10154
+ description: "",
10155
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
10156
+ },
10157
+ {
10158
+ name: "ChartWithFormations",
10159
+ description: "",
10160
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
10161
+ },
10162
+ {
10163
+ name: "AdditionalButtonsChart",
10164
+ description: "",
10165
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
10166
+ },
10167
+ {
10168
+ name: "BarChart",
10169
+ description: "",
10170
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
10171
+ },
10172
+ {
10173
+ name: "StackedBarChart",
10174
+ description: "",
10175
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
10176
+ },
10177
+ {
10178
+ name: "SmallChart",
10179
+ description: "",
10180
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10181
+ },
10182
+ {
10183
+ name: "AxisDropdownChart",
10184
+ description: "",
10185
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
10186
+ },
10187
+ {
10188
+ name: "ChartRightAxis",
10189
+ description: "",
10190
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
10191
+ },
10192
+ {
10193
+ name: "ChartTwoValuesAxis",
10194
+ description: "",
10195
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
10196
+ },
10197
+ {
10198
+ name: "MobileResponsiveChart",
10199
+ description: "",
10200
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
10201
+ },
10202
+ {
10203
+ name: "HighchartStockChart",
10204
+ description: "",
10205
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
10206
+ },
10207
+ {
10208
+ name: "DonutChart",
10209
+ description: "",
10210
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
10211
+ }
10212
+ ],
10213
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ResetZoomButton.js",
10214
+ keywords: [
10215
+ "resetzoombutton",
10216
+ "reset",
10217
+ "zoom",
10218
+ "button",
10219
+ "chart",
10220
+ "family.",
10221
+ "story",
10222
+ "canonical",
10223
+ "usage."
10224
+ ]
10225
+ },
10226
+ {
10227
+ name: "HideAxesButton",
10228
+ modulePath: "components/Chart/components/buttons/HideAxesButton",
10229
+ importPath: "@corva/ui/components",
10230
+ category: "v1",
10231
+ description: "HideAxesButton — hide axes button for the Chart family. See the Chart story for canonical usage.",
10232
+ isExperimental: false,
10233
+ isDeprecated: false,
10234
+ props: [
10235
+ ],
10236
+ examples: [
10237
+ {
10238
+ name: "Chart",
10239
+ description: "",
10240
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10241
+ },
10242
+ {
10243
+ name: "AxisConfigRegularSpacing",
10244
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10245
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
10246
+ },
10247
+ {
10248
+ name: "AxisConfigDenseSpacing",
10249
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10250
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
10251
+ },
10252
+ {
10253
+ name: "ChartsWithDropdownAxes",
10254
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
10255
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
10256
+ },
10257
+ {
10258
+ name: "MultipleAxesChart",
10259
+ description: "",
10260
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
10261
+ },
10262
+ {
10263
+ name: "CustomizeScaleChart",
10264
+ description: "",
10265
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
10266
+ },
10267
+ {
10268
+ name: "CustomizeScaleChartInverted",
10269
+ description: "",
10270
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
10271
+ },
10272
+ {
10273
+ name: "ChartWithFormations",
10274
+ description: "",
10275
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
10276
+ },
10277
+ {
10278
+ name: "AdditionalButtonsChart",
10279
+ description: "",
10280
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
10281
+ },
10282
+ {
10283
+ name: "BarChart",
10284
+ description: "",
10285
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
10286
+ },
10287
+ {
10288
+ name: "StackedBarChart",
10289
+ description: "",
10290
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
10291
+ },
10292
+ {
10293
+ name: "SmallChart",
10294
+ description: "",
10295
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10296
+ },
10297
+ {
10298
+ name: "AxisDropdownChart",
10299
+ description: "",
10300
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
10301
+ },
10302
+ {
10303
+ name: "ChartRightAxis",
10304
+ description: "",
10305
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
10306
+ },
10307
+ {
10308
+ name: "ChartTwoValuesAxis",
10309
+ description: "",
10310
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
10311
+ },
10312
+ {
10313
+ name: "MobileResponsiveChart",
10314
+ description: "",
10315
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
10316
+ },
10317
+ {
10318
+ name: "HighchartStockChart",
10319
+ description: "",
10320
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
10321
+ },
10322
+ {
10323
+ name: "DonutChart",
10324
+ description: "",
10325
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
10326
+ }
10327
+ ],
10328
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/HideAxesButton.js",
10329
+ keywords: [
10330
+ "hideaxesbutton",
10331
+ "hide",
10332
+ "axes",
10333
+ "button",
10334
+ "chart",
10335
+ "family.",
10336
+ "story",
10337
+ "canonical",
10338
+ "usage."
10339
+ ]
10340
+ },
10341
+ {
10342
+ name: "ChartTypeButton",
10343
+ modulePath: "components/Chart/components/buttons/ChartTypeButton",
10344
+ importPath: "@corva/ui/components",
10345
+ category: "v1",
10346
+ description: "ChartTypeButton — chart type button for the Chart family. See the Chart story for canonical usage.",
10347
+ isExperimental: false,
10348
+ isDeprecated: false,
10349
+ props: [
10350
+ ],
10351
+ examples: [
10352
+ {
10353
+ name: "Chart",
10354
+ description: "",
10355
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton />\n <DragToZoomButton />\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10356
+ },
10357
+ {
10358
+ name: "AxisConfigRegularSpacing",
10359
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10360
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: getChartHorizontalAxis({\n title: 'MD (ft)',\n spacing: 'normal',\n opposite,\n }),\n yAxis: getChartVerticalAxis({\n title: 'TvD (ft)',\n spacing: 'normal',\n opposite,\n }),\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange={setOpposite} />\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef}>{chartElement}</ChartWrapper>\n </div>\n </div>\n </SbColumn>\n );\n}"
10361
+ },
10362
+ {
10363
+ name: "AxisConfigDenseSpacing",
10364
+ description: "Use `getChartHorizontalAxis` and `getChartVerticalAxis` utility functions from `@corva/ui/utils` to get standartized axis config objects.\n\nUse `spacing: 'dense'` option for charts where the axis has only start and end values, and the title should be in line with them\n\n⚠️ Warning! Do not overwrite the `title.text` property of the resulting config",
10365
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [opposite, setOpposite] = useState(false);\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 48,\n tickAmount: 2,\n tickPositions: [0, 48],\n },\n yAxis: {\n ...getChartVerticalAxis({\n title: 'Mud Weight (ppg)',\n spacing: 'dense',\n opposite,\n }),\n min: 0,\n max: 8000,\n tickAmount: 2,\n tickPositions: [0, 8000],\n },\n legend: {\n enabled: false,\n },\n };\n\n const chartElement = (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n\n return (\n <SbColumn alignItems=\"stretch\">\n <Switch onLabel=\"Opposite Axes\" size=\"small\" checked={opposite} onChange=\n// ... (truncated)"
10366
+ },
10367
+ {
10368
+ name: "ChartsWithDropdownAxes",
10369
+ description: "Use `<AxisDropdown/>` component to use a dropdown as a chart title. Remember, you should provide its positioning on your own",
10370
+ code: "{\n const classes = useStyles();\n const chartRef = useRef();\n const [dropdownValue, setDropdownValue] = useState('test1');\n const [isDense, setIsDense] = useState(false);\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const denseHorizontalAxisOptions = { min: 0, max: 48, tickAmount: 2, tickPositions: [0, 48] };\n\n const denseVerticalAxisOptions = { min: 0, max: 8000, tickAmount: 2, tickPositions: [0, 8000] };\n\n const options = {\n ...getChartOptions({\n seriesCount,\n recordsCount,\n }),\n xAxis: {\n ...getChartHorizontalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && denseHorizontalAxisOptions),\n },\n yAxis: {\n ...getChartVerticalAxis({\n spacing: isDense ? 'dense' : 'normal',\n }),\n ...(isDense && d\n// ... (truncated)"
10371
+ },
10372
+ {
10373
+ name: "MultipleAxesChart",
10374
+ description: "",
10375
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const customOptions = {\n yAxis: [\n getChartVerticalAxis({ title: 'Temperature (°C)' }),\n getChartVerticalAxis({ title: 'Rainfall (mm)', offset: 44 }),\n ],\n xAxis: getChartHorizontalAxis({ title: 'Days' }),\n series: [\n {\n name: 'Rainfall',\n yAxis: 1,\n data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],\n tooltip: {\n valueSuffix: ' mm',\n },\n },\n {\n name: 'Temperature',\n type: 'column',\n data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],\n tooltip: {\n valueSuffix: ' °C',\n },\n },\n ],\n };\n\n const opt\n// ... (truncated)"
10376
+ },
10377
+ {
10378
+ name: "CustomizeScaleChart",
10379
+ description: "",
10380
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n// ... (truncated)"
10381
+ },
10382
+ {
10383
+ name: "CustomizeScaleChartInverted",
10384
+ description: "",
10385
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const onCustomizeScaleClick = event => {\n // eslint-disable-next-line no-alert\n alert(\n JSON.stringify({\n min: event.min,\n max: event.max,\n })\n );\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={{ ...options, chart: { ...options.chart, inverted: true } }}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} onCustomizeScaleClick={onCustomizeScaleClick} {...props}>\n {options && chartElement}\n \n// ... (truncated)"
10386
+ },
10387
+ {
10388
+ name: "ChartWithFormations",
10389
+ description: "",
10390
+ code: "props => {\n const [, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const plotLines = getFormattedFormations(props.formations, props.axis === 'y');\n\n useEffect(() => {\n if (chartRef.current) {\n chartRef.current.chart.setSize();\n renderFormations({ chart: chartRef.current.chart, plotLines, axis: props.axis });\n }\n setMounted(true);\n }, [props.axis]);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} withFormations {...props}>\n {options && chartElement}\n <ChartButtons>\n <ResetZoomButton />\n <PanButton /\n// ... (truncated)"
10391
+ },
10392
+ {
10393
+ name: "AdditionalButtonsChart",
10394
+ description: "",
10395
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const handleChartTypeChange = chartType => {\n if (chartType === 'bar') {\n chartRef.current.chart.update({\n legend: {\n symbolHeight: 12,\n },\n });\n }\n };\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons className={classes.horizontalControls}>\n <ChartTypeButton onClick={handleChartTypeChange} />\n <ChartSelect\n \n// ... (truncated)"
10396
+ },
10397
+ {
10398
+ name: "BarChart",
10399
+ description: "",
10400
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Metric 1', 'Metric 2', 'Metric 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n series: [\n {\n name: 'Metric',\n borderColor: 'transparent',\n color: '#6CDBB5',\n data: [5, 3, 2],\n },\n ],\n tooltip: {\n crosshairs: null,\n },\n }\n );\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root\n// ... (truncated)"
10401
+ },
10402
+ {
10403
+ name: "StackedBarChart",
10404
+ description: "",
10405
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n {},\n getChartOptions({\n seriesCount: 0,\n recordsCount: 0,\n }),\n {\n chart: { type: props.inverted ? 'column' : 'bar' },\n xAxis: {\n categories: ['Category 1', 'Category 2', 'Category 3'],\n },\n legend: {\n symbolHeight: 8,\n symbolPadding: 4,\n },\n plotOptions: {\n series: {\n stacking: 'normal',\n },\n },\n tooltip: {\n crosshairs: null,\n },\n series: [\n {\n name: 'Series 1',\n color: '#A153EC',\n borderColor: 'transparent',\n data: [7, 1, 3],\n },\n {\n name: 'Series 2',\n color: '#5823E1',\n borderColor: 'transparent',\n data: [2, 1, 1],\n },\n {\n name: 'Series 3',\n color: \n// ... (truncated)"
10406
+ },
10407
+ {
10408
+ name: "SmallChart",
10409
+ description: "",
10410
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n );\n }, [options]);\n\n return (\n <div className={classes.root}>\n <div className={classes.smallChart}>\n <ChartWrapper chartRef={chartRef} {...props}>\n {options && chartElement}\n <ChartButtons>\n <ZoomInButton />\n <ZoomOutButton />\n </ChartButtons>\n </ChartWrapper>\n </div>\n </div>\n );\n}"
10411
+ },
10412
+ {
10413
+ name: "AxisDropdownChart",
10414
+ description: "",
10415
+ code: "props => {\n const [, setMounted] = useState(false);\n const [dropdownValue, setDropdownValue] = useState('test1');\n\n const chartRef = useRef();\n const classes = useStyles();\n const dropdownClasses = useDropdownStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const dropdownOptions = [\n { label: 'test1', value: 'test1' },\n { label: 'test2', value: 'test2' },\n { label: 'test3', value: 'test3' },\n ];\n\n const handleDropdownValueChange = ({ target }) => {\n setDropdownValue(target.value);\n };\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n chart: {\n spacingLeft: 60,\n },\n yAxis: {\n title: {\n margin: 16,\n text: null,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -1\n// ... (truncated)"
10416
+ },
10417
+ {
10418
+ name: "ChartRightAxis",
10419
+ description: "",
10420
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n lineWidth: 1,\n lineColor: '#3B3B3B',\n opposite: true,\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n )}\n </div>\n </div>\n );\n}"
10421
+ },
10422
+ {
10423
+ name: "ChartTwoValuesAxis",
10424
+ description: "",
10425
+ code: "{\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n if (chartRef.current) chartRef.current.chart.setSize();\n setMounted(true);\n }, []);\n\n const options = merge(\n {\n yAxis: {\n min: 0,\n max: 8000,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 8000],\n title: {\n margin: -14,\n },\n },\n xAxis: {\n min: 0,\n max: 48,\n minorTicks: false,\n tickAmount: 2,\n tickPositions: [0, 48],\n title: {\n margin: -14,\n },\n },\n },\n getChartOptions({\n seriesCount,\n recordsCount,\n })\n );\n\n return (\n <div className={classes.root}>\n <div className={classes.chart}>\n {options && (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chartRef}\n />\n \n// ... (truncated)"
10426
+ },
10427
+ {
10428
+ name: "MobileResponsiveChart",
10429
+ description: "",
10430
+ code: "props => {\n const [isMounted, setMounted] = useState(false);\n const chartRef = useRef();\n const classes = useStyles();\n\n const theme = useTheme();\n const isTabletView = useMediaQuery(theme.breakpoints.down('sm'));\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = merge(\n getChartOptions({\n seriesCount,\n recordsCount,\n }),\n {\n xAxis: {\n maxPadding: 0,\n },\n responsive: null,\n legend: {\n enabled: false,\n },\n }\n );\n\n useEffect(() => {\n if (isTabletView) {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0,\n },\n });\n } else {\n chartRef.current?.chart.update({\n xAxis: {\n maxPadding: 0.04,\n },\n });\n }\n }, [isMounted, isTabletView]);\n\n const chartElement = useMemo(() => {\n return (\n <HighchartsReact\n highcharts={Highcharts}\n options={options}\n containerProps={containerProps}\n ref={chart\n// ... (truncated)"
10431
+ },
10432
+ {
10433
+ name: "HighchartStockChart",
10434
+ description: "",
10435
+ code: "props => {\n const [, setMounted] = useState(false);\n\n const chartRef = useRef();\n const classes = useStyles();\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n const options = getChartOptions({\n seriesCount,\n recordsCount,\n });\n\n const stockOptions = {\n ...options,\n tooltip: {\n headerFormat: '',\n ...options.tooltip,\n },\n rangeSelector: {\n enabled: false,\n },\n yAxis: {\n opposite: false,\n ...options.yAxis,\n title: null,\n crosshair: {\n ...options.yAxis.crosshair,\n label: {\n enabled: true,\n format: '{value:.2f}',\n shape: 'box',\n borderRadius: '4px',\n backgroundColor: 'rgba(82, 80, 80, 0.5)',\n padding: 2,\n style: {\n color: '#ffffff',\n backgroundColor: 'rgba(82, 80, 80, 0.8)',\n },\n },\n },\n },\n xAxis: {\n ...options.xAxis,\n crosshair: {\n ...options.xAxis.crosshair,\n label: {\n \n// ... (truncated)"
10436
+ },
10437
+ {
10438
+ name: "DonutChart",
10439
+ description: "",
10440
+ code: "{\n const options = getAppUsageOptions({\n data,\n isFullChartLegendVisible: false,\n appNumber: 10,\n });\n\n return <HighchartsReact highcharts={Highcharts} options={options} immutable />;\n}"
10441
+ }
10442
+ ],
10443
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ChartTypeButton.js",
10444
+ keywords: [
10445
+ "charttypebutton",
10446
+ "chart",
10447
+ "type",
10448
+ "button",
10449
+ "family.",
10450
+ "story",
10451
+ "canonical",
10452
+ "usage."
10453
+ ]
10454
+ },
9008
10455
  {
9009
10456
  name: "ChartActionsList",
9010
10457
  modulePath: "components/ChartActionsList",
@@ -75697,6 +77144,13 @@ var clientsData = [
75697
77144
  "list",
75698
77145
  "aggregate",
75699
77146
  "pipeline",
77147
+ "aggregate_summary",
77148
+ "summary",
77149
+ "return",
77150
+ "source",
77151
+ "collection",
77152
+ "upsert",
77153
+ "target",
75700
77154
  "batch_update",
75701
77155
  "batch",
75702
77156
  "update",
@@ -75721,7 +77175,11 @@ var clientsData = [
75721
77175
  "key",
75722
77176
  "subscriptions",
75723
77177
  "publish",
75724
- "asset"
77178
+ "asset",
77179
+ "legacy-data",
77180
+ "legacy",
77181
+ "without",
77182
+ "show"
75725
77183
  ],
75726
77184
  endpoints: [
75727
77185
  {
@@ -75844,13 +77302,184 @@ var clientsData = [
75844
77302
  ],
75845
77303
  requestBody: {
75846
77304
  contentType: "application/json",
75847
- schema: "{ company_id: object | object, provider: object | object, collection: object | object, asset_id: object | object, version: number, ... }[] | { data: { company_id: object, provider: object, collection: object, asset_id: object, version: object, ... }[], producer: { app_connection_id: number } }",
77305
+ schema: "{ company_id: object | object, provider: object | object, collection: object | object, asset_id: object | object, version: number, ... }[] | { data: { company_id: object, provider: object, collection: object, asset_id: object, version: object, ... }[], producer: { app_connection_id: number } }",
77306
+ required: true
77307
+ },
77308
+ responses: {
77309
+ "200": {
77310
+ description: "Successful Response",
77311
+ schema: "{ inserted_ids: string[], failed_count: number, messages: string[] }"
77312
+ },
77313
+ "422": {
77314
+ description: "Validation Error",
77315
+ schema: "{ code: number, message: string }"
77316
+ }
77317
+ }
77318
+ },
77319
+ {
77320
+ path: "/api/v1/data/{provider}/{dataset}/",
77321
+ method: "PUT",
77322
+ operationId: "replace_api_v1_data__provider___dataset___put",
77323
+ summary: "Insert new Document",
77324
+ tags: [
77325
+ "data"
77326
+ ],
77327
+ parameters: [
77328
+ {
77329
+ name: "provider",
77330
+ "in": "path",
77331
+ type: "string",
77332
+ required: true,
77333
+ description: ""
77334
+ },
77335
+ {
77336
+ name: "dataset",
77337
+ "in": "path",
77338
+ type: "string",
77339
+ required: true,
77340
+ description: ""
77341
+ },
77342
+ {
77343
+ name: "id",
77344
+ "in": "query",
77345
+ type: "string",
77346
+ required: false,
77347
+ description: ""
77348
+ }
77349
+ ],
77350
+ requestBody: {
77351
+ contentType: "application/json",
77352
+ schema: "{ company_id: number | null, provider: string | null, collection: string | null, asset_id: number | null, version: number, ... }",
77353
+ required: true
77354
+ },
77355
+ responses: {
77356
+ "200": {
77357
+ description: "Successful Response",
77358
+ schema: "{ _id: string | null, company_id: number | null, asset_id: number | null, version: number, provider: string, ... }"
77359
+ },
77360
+ "422": {
77361
+ description: "Validation Error",
77362
+ schema: "{ code: number, message: string }"
77363
+ }
77364
+ }
77365
+ },
77366
+ {
77367
+ path: "/api/v1/data/{provider}/{dataset}/",
77368
+ method: "DELETE",
77369
+ operationId: "delete_many_api_v1_data__provider___dataset___delete",
77370
+ summary: "Delete multiple Documents",
77371
+ tags: [
77372
+ "data"
77373
+ ],
77374
+ parameters: [
77375
+ {
77376
+ name: "provider",
77377
+ "in": "path",
77378
+ type: "string",
77379
+ required: true,
77380
+ description: ""
77381
+ },
77382
+ {
77383
+ name: "dataset",
77384
+ "in": "path",
77385
+ type: "string",
77386
+ required: true,
77387
+ description: ""
77388
+ },
77389
+ {
77390
+ name: "query",
77391
+ "in": "query",
77392
+ type: "string",
77393
+ required: true,
77394
+ description: "A query that matches the documents to delete"
77395
+ }
77396
+ ],
77397
+ responses: {
77398
+ "200": {
77399
+ description: "Successful Response",
77400
+ schema: "{ deleted_count: number }"
77401
+ },
77402
+ "422": {
77403
+ description: "Validation Error",
77404
+ schema: "{ code: number, message: string }"
77405
+ }
77406
+ }
77407
+ },
77408
+ {
77409
+ path: "/api/v1/data/{provider}/{dataset}/count/",
77410
+ method: "GET",
77411
+ operationId: "count_api_v1_data__provider___dataset__count__get",
77412
+ summary: "Count Data",
77413
+ tags: [
77414
+ "data"
77415
+ ],
77416
+ parameters: [
77417
+ {
77418
+ name: "provider",
77419
+ "in": "path",
77420
+ type: "string",
77421
+ required: true,
77422
+ description: ""
77423
+ },
77424
+ {
77425
+ name: "dataset",
77426
+ "in": "path",
77427
+ type: "string",
77428
+ required: true,
77429
+ description: ""
77430
+ },
77431
+ {
77432
+ name: "query",
77433
+ "in": "query",
77434
+ type: "string",
77435
+ required: true,
77436
+ description: "Search conditions"
77437
+ }
77438
+ ],
77439
+ responses: {
77440
+ "200": {
77441
+ description: "Successful Response",
77442
+ schema: "{ count: number }"
77443
+ },
77444
+ "422": {
77445
+ description: "Validation Error",
77446
+ schema: "{ code: number, message: string }"
77447
+ }
77448
+ }
77449
+ },
77450
+ {
77451
+ path: "/api/v1/data/{provider}/{dataset}/list/",
77452
+ method: "POST",
77453
+ operationId: "listDataByProviderAndDataset",
77454
+ summary: "Find Data",
77455
+ tags: [
77456
+ "data"
77457
+ ],
77458
+ parameters: [
77459
+ {
77460
+ name: "provider",
77461
+ "in": "path",
77462
+ type: "string",
77463
+ required: true,
77464
+ description: ""
77465
+ },
77466
+ {
77467
+ name: "dataset",
77468
+ "in": "path",
77469
+ type: "string",
77470
+ required: true,
77471
+ description: ""
77472
+ }
77473
+ ],
77474
+ requestBody: {
77475
+ contentType: "application/json",
77476
+ schema: "{ query: object, sort: { sort: object }, skip: number, limit: number, fields: string, ... }",
75848
77477
  required: true
75849
77478
  },
75850
77479
  responses: {
75851
77480
  "200": {
75852
77481
  description: "Successful Response",
75853
- schema: "{ inserted_ids: string[], failed_count: number, messages: string[] }"
77482
+ schema: "{ _id: string | null, company_id: number | null, asset_id: number | null, version: number, provider: string, ... }[]"
75854
77483
  },
75855
77484
  "422": {
75856
77485
  description: "Validation Error",
@@ -75859,10 +77488,10 @@ var clientsData = [
75859
77488
  }
75860
77489
  },
75861
77490
  {
75862
- path: "/api/v1/data/{provider}/{dataset}/",
75863
- method: "PUT",
75864
- operationId: "replace_api_v1_data__provider___dataset___put",
75865
- summary: "Insert new Document",
77491
+ path: "/api/v1/data/{provider}/{dataset}/aggregate/",
77492
+ method: "GET",
77493
+ operationId: "aggregate_api_v1_data__provider___dataset__aggregate__get",
77494
+ summary: "Find Data using MongoDB aggregation pipeline (simple)",
75866
77495
  tags: [
75867
77496
  "data"
75868
77497
  ],
@@ -75882,64 +77511,52 @@ var clientsData = [
75882
77511
  description: ""
75883
77512
  },
75884
77513
  {
75885
- name: "id",
77514
+ name: "match",
75886
77515
  "in": "query",
75887
77516
  type: "string",
75888
- required: false,
75889
- description: ""
75890
- }
75891
- ],
75892
- requestBody: {
75893
- contentType: "application/json",
75894
- schema: "{ company_id: number | null, provider: string | null, collection: string | null, asset_id: number | null, version: number, ... }",
75895
- required: true
75896
- },
75897
- responses: {
75898
- "200": {
75899
- description: "Successful Response",
75900
- schema: "{ _id: string | null, company_id: number | null, asset_id: number | null, version: number, provider: string, ... }"
77517
+ required: true,
77518
+ description: "Match stage"
75901
77519
  },
75902
- "422": {
75903
- description: "Validation Error",
75904
- schema: "{ code: number, message: string }"
75905
- }
75906
- }
75907
- },
75908
- {
75909
- path: "/api/v1/data/{provider}/{dataset}/",
75910
- method: "DELETE",
75911
- operationId: "delete_many_api_v1_data__provider___dataset___delete",
75912
- summary: "Delete multiple Documents",
75913
- tags: [
75914
- "data"
75915
- ],
75916
- parameters: [
75917
77520
  {
75918
- name: "provider",
75919
- "in": "path",
77521
+ name: "group",
77522
+ "in": "query",
75920
77523
  type: "string",
75921
- required: true,
75922
- description: ""
77524
+ required: false,
77525
+ description: "Group stage"
75923
77526
  },
75924
77527
  {
75925
- name: "dataset",
75926
- "in": "path",
77528
+ name: "project",
77529
+ "in": "query",
75927
77530
  type: "string",
77531
+ required: false,
77532
+ description: "Project stage"
77533
+ },
77534
+ {
77535
+ name: "skip",
77536
+ "in": "query",
77537
+ type: "number",
77538
+ required: false,
77539
+ description: "Number of records to skip (default: 0)"
77540
+ },
77541
+ {
77542
+ name: "limit",
77543
+ "in": "query",
77544
+ type: "number",
75928
77545
  required: true,
75929
- description: ""
77546
+ description: "Maximum number of results to return"
75930
77547
  },
75931
77548
  {
75932
- name: "query",
77549
+ name: "sort",
75933
77550
  "in": "query",
75934
77551
  type: "string",
75935
77552
  required: true,
75936
- description: "A query that matches the documents to delete"
77553
+ description: "Sort conditions as JSON string"
75937
77554
  }
75938
77555
  ],
75939
77556
  responses: {
75940
77557
  "200": {
75941
77558
  description: "Successful Response",
75942
- schema: "{ deleted_count: number }"
77559
+ schema: "object[]"
75943
77560
  },
75944
77561
  "422": {
75945
77562
  description: "Validation Error",
@@ -75948,10 +77565,10 @@ var clientsData = [
75948
77565
  }
75949
77566
  },
75950
77567
  {
75951
- path: "/api/v1/data/{provider}/{dataset}/count/",
77568
+ path: "/api/v1/data/{provider}/{dataset}/aggregate/pipeline/",
75952
77569
  method: "GET",
75953
- operationId: "count_api_v1_data__provider___dataset__count__get",
75954
- summary: "Count Data",
77570
+ operationId: "aggregate_pipeline_get_api_v1_data__provider___dataset__aggregate_pipeline__get",
77571
+ summary: "Find Data using MongoDB aggregation pipeline (complex)",
75955
77572
  tags: [
75956
77573
  "data"
75957
77574
  ],
@@ -75971,17 +77588,17 @@ var clientsData = [
75971
77588
  description: ""
75972
77589
  },
75973
77590
  {
75974
- name: "query",
77591
+ name: "stages",
75975
77592
  "in": "query",
75976
77593
  type: "string",
75977
77594
  required: true,
75978
- description: "Search conditions"
77595
+ description: "List of aggregation stages."
75979
77596
  }
75980
77597
  ],
75981
77598
  responses: {
75982
77599
  "200": {
75983
77600
  description: "Successful Response",
75984
- schema: "{ count: number }"
77601
+ schema: "object[]"
75985
77602
  },
75986
77603
  "422": {
75987
77604
  description: "Validation Error",
@@ -75990,10 +77607,10 @@ var clientsData = [
75990
77607
  }
75991
77608
  },
75992
77609
  {
75993
- path: "/api/v1/data/{provider}/{dataset}/list/",
77610
+ path: "/api/v1/data/{provider}/{dataset}/aggregate/pipeline/",
75994
77611
  method: "POST",
75995
- operationId: "listDataByProviderAndDataset",
75996
- summary: "Find Data",
77612
+ operationId: "aggregate_pipeline_post_api_v1_data__provider___dataset__aggregate_pipeline__post",
77613
+ summary: "Find Data using MongoDB aggregation pipeline (complex)",
75997
77614
  tags: [
75998
77615
  "data"
75999
77616
  ],
@@ -76015,13 +77632,13 @@ var clientsData = [
76015
77632
  ],
76016
77633
  requestBody: {
76017
77634
  contentType: "application/json",
76018
- schema: "{ query: object, sort: { sort: object }, skip: number, limit: number, fields: string, ... }",
77635
+ schema: "{ stages: object[] }",
76019
77636
  required: true
76020
77637
  },
76021
77638
  responses: {
76022
77639
  "200": {
76023
77640
  description: "Successful Response",
76024
- schema: "{ _id: string | null, company_id: number | null, asset_id: number | null, version: number, provider: string, ... }[]"
77641
+ schema: "object[]"
76025
77642
  },
76026
77643
  "422": {
76027
77644
  description: "Validation Error",
@@ -76030,10 +77647,10 @@ var clientsData = [
76030
77647
  }
76031
77648
  },
76032
77649
  {
76033
- path: "/api/v1/data/{provider}/{dataset}/aggregate/",
76034
- method: "GET",
76035
- operationId: "aggregate_api_v1_data__provider___dataset__aggregate__get",
76036
- summary: "Find Data using MongoDB aggregation pipeline (simple)",
77650
+ path: "/api/v1/data/{provider}/{source_collection}/aggregate_summary/",
77651
+ method: "POST",
77652
+ operationId: "aggregate_summary_return_api_v1_data__provider___source_collection__aggregate_summary__post",
77653
+ summary: "Aggregate summary data by intervals and return results",
76037
77654
  tags: [
76038
77655
  "data"
76039
77656
  ],
@@ -76046,55 +77663,18 @@ var clientsData = [
76046
77663
  description: ""
76047
77664
  },
76048
77665
  {
76049
- name: "dataset",
77666
+ name: "source_collection",
76050
77667
  "in": "path",
76051
77668
  type: "string",
76052
77669
  required: true,
76053
77670
  description: ""
76054
- },
76055
- {
76056
- name: "match",
76057
- "in": "query",
76058
- type: "string",
76059
- required: true,
76060
- description: "Match stage"
76061
- },
76062
- {
76063
- name: "group",
76064
- "in": "query",
76065
- type: "string",
76066
- required: false,
76067
- description: "Group stage"
76068
- },
76069
- {
76070
- name: "project",
76071
- "in": "query",
76072
- type: "string",
76073
- required: false,
76074
- description: "Project stage"
76075
- },
76076
- {
76077
- name: "skip",
76078
- "in": "query",
76079
- type: "number",
76080
- required: false,
76081
- description: "Number of records to skip (default: 0)"
76082
- },
76083
- {
76084
- name: "limit",
76085
- "in": "query",
76086
- type: "number",
76087
- required: true,
76088
- description: "Maximum number of results to return"
76089
- },
76090
- {
76091
- name: "sort",
76092
- "in": "query",
76093
- type: "string",
76094
- required: true,
76095
- description: "Sort conditions as JSON string"
76096
77671
  }
76097
77672
  ],
77673
+ requestBody: {
77674
+ contentType: "application/json",
77675
+ schema: "{ match_field: string, operations: \"median\" | \"avg\" | \"min\" | \"max\"[], intervals: { start: number, end: number }[], asset_id: number, exclude_data_fields: string[] }",
77676
+ required: true
77677
+ },
76098
77678
  responses: {
76099
77679
  "200": {
76100
77680
  description: "Successful Response",
@@ -76107,10 +77687,10 @@ var clientsData = [
76107
77687
  }
76108
77688
  },
76109
77689
  {
76110
- path: "/api/v1/data/{provider}/{dataset}/aggregate/pipeline/",
76111
- method: "GET",
76112
- operationId: "aggregate_pipeline_get_api_v1_data__provider___dataset__aggregate_pipeline__get",
76113
- summary: "Find Data using MongoDB aggregation pipeline (complex)",
77690
+ path: "/api/v1/data/{provider}/{source_collection}/aggregate_summary/{target_collection}/",
77691
+ method: "POST",
77692
+ operationId: "aggregate_summary_upsert_api_v1_data__provider___source_collection__aggregate_summary__target_collection___post",
77693
+ summary: "Aggregate summary data by intervals and upsert results into target collection",
76114
77694
  tags: [
76115
77695
  "data"
76116
77696
  ],
@@ -76123,49 +77703,14 @@ var clientsData = [
76123
77703
  description: ""
76124
77704
  },
76125
77705
  {
76126
- name: "dataset",
77706
+ name: "source_collection",
76127
77707
  "in": "path",
76128
77708
  type: "string",
76129
77709
  required: true,
76130
77710
  description: ""
76131
77711
  },
76132
77712
  {
76133
- name: "stages",
76134
- "in": "query",
76135
- type: "string",
76136
- required: true,
76137
- description: "List of aggregation stages."
76138
- }
76139
- ],
76140
- responses: {
76141
- "200": {
76142
- description: "Successful Response",
76143
- schema: "object[]"
76144
- },
76145
- "422": {
76146
- description: "Validation Error",
76147
- schema: "{ code: number, message: string }"
76148
- }
76149
- }
76150
- },
76151
- {
76152
- path: "/api/v1/data/{provider}/{dataset}/aggregate/pipeline/",
76153
- method: "POST",
76154
- operationId: "aggregate_pipeline_post_api_v1_data__provider___dataset__aggregate_pipeline__post",
76155
- summary: "Find Data using MongoDB aggregation pipeline (complex)",
76156
- tags: [
76157
- "data"
76158
- ],
76159
- parameters: [
76160
- {
76161
- name: "provider",
76162
- "in": "path",
76163
- type: "string",
76164
- required: true,
76165
- description: ""
76166
- },
76167
- {
76168
- name: "dataset",
77713
+ name: "target_collection",
76169
77714
  "in": "path",
76170
77715
  type: "string",
76171
77716
  required: true,
@@ -76174,7 +77719,7 @@ var clientsData = [
76174
77719
  ],
76175
77720
  requestBody: {
76176
77721
  contentType: "application/json",
76177
- schema: "{ stages: object[] }",
77722
+ schema: "{ match_field: string, operations: \"median\" | \"avg\" | \"min\" | \"max\"[], intervals: { start: number, end: number }[], asset_id: number, exclude_data_fields: string[], ... }",
76178
77723
  required: true
76179
77724
  },
76180
77725
  responses: {
@@ -76922,9 +78467,122 @@ var clientsData = [
76922
78467
  }
76923
78468
  },
76924
78469
  {
76925
- path: "/api/v1/message_producer/",
78470
+ path: "/api/v1/message_producer/",
78471
+ method: "POST",
78472
+ operationId: "produce_api_v1_message_producer__post",
78473
+ summary: "Produce Messages",
78474
+ tags: [
78475
+ "data"
78476
+ ],
78477
+ parameters: [
78478
+ {
78479
+ name: "app_key",
78480
+ "in": "query",
78481
+ type: "string | null",
78482
+ required: false,
78483
+ description: ""
78484
+ }
78485
+ ],
78486
+ requestBody: {
78487
+ contentType: "application/json",
78488
+ schema: "{ app_connection_id: number | null, data: { timestamp: object, collection: object }[] | { timestamp: object, collection: object, measured_depth: object }[] | null, force_schedules: boolean, produce_as: string | null, rerun_begins: number | null, ... }",
78489
+ required: true
78490
+ },
78491
+ responses: {
78492
+ "200": {
78493
+ description: "Successful Response",
78494
+ schema: "any"
78495
+ },
78496
+ "422": {
78497
+ description: "Validation Error",
78498
+ schema: "{ code: number, message: string }"
78499
+ }
78500
+ }
78501
+ },
78502
+ {
78503
+ path: "/api/v1/subscriptions/{provider}/{dataset}/{asset_id}/",
78504
+ method: "POST",
78505
+ operationId: "publish_api_v1_subscriptions__provider___dataset___asset_id___post",
78506
+ summary: "Publish data to Corva Subscriptions Server.",
78507
+ description: "Publish data to **Corva Subscriptions Server** channel named `{provider}/{dataset}/{asset_id}`.",
78508
+ tags: [
78509
+ "data"
78510
+ ],
78511
+ parameters: [
78512
+ {
78513
+ name: "provider",
78514
+ "in": "path",
78515
+ type: "string",
78516
+ required: true,
78517
+ description: ""
78518
+ },
78519
+ {
78520
+ name: "dataset",
78521
+ "in": "path",
78522
+ type: "string",
78523
+ required: true,
78524
+ description: ""
78525
+ },
78526
+ {
78527
+ name: "asset_id",
78528
+ "in": "path",
78529
+ type: "number",
78530
+ required: true,
78531
+ description: ""
78532
+ }
78533
+ ],
78534
+ requestBody: {
78535
+ contentType: "application/json",
78536
+ schema: "object | object[]",
78537
+ required: true
78538
+ },
78539
+ responses: {
78540
+ "204": {
78541
+ description: "Successful Response"
78542
+ },
78543
+ "422": {
78544
+ description: "Validation Error",
78545
+ schema: "{ code: number, message: string }"
78546
+ }
78547
+ }
78548
+ },
78549
+ {
78550
+ path: "/v1/message_producer/{app_key}",
78551
+ method: "POST",
78552
+ operationId: "produce_v1_message_producer__app_key__post",
78553
+ summary: "Produce Messages (corva-api compatibility)",
78554
+ tags: [
78555
+ "data"
78556
+ ],
78557
+ parameters: [
78558
+ {
78559
+ name: "app_key",
78560
+ "in": "path",
78561
+ type: "string | null",
78562
+ required: true,
78563
+ description: ""
78564
+ }
78565
+ ],
78566
+ requestBody: {
78567
+ contentType: "application/json",
78568
+ schema: "{ app_connection_id: number | null, data: { timestamp: object, collection: object }[] | { timestamp: object, collection: object, measured_depth: object }[] | null, force_schedules: boolean, produce_as: string | null, rerun_begins: number | null, ... }",
78569
+ required: true
78570
+ },
78571
+ responses: {
78572
+ "200": {
78573
+ description: "Successful Response",
78574
+ schema: "any"
78575
+ },
78576
+ "422": {
78577
+ description: "Validation Error",
78578
+ schema: "{ code: number, message: string }"
78579
+ }
78580
+ }
78581
+ },
78582
+ {
78583
+ path: "/v1/message_producer/",
76926
78584
  method: "POST",
76927
- operationId: "produce_api_v1_message_producer__post",
78585
+ operationId: "produce_v1_message_producer__post",
76928
78586
  summary: "Produce Messages",
76929
78587
  tags: [
76930
78588
  "data"
@@ -76955,13 +78613,57 @@ var clientsData = [
76955
78613
  }
76956
78614
  },
76957
78615
  {
76958
- path: "/api/v1/subscriptions/{provider}/{dataset}/{asset_id}/",
76959
- method: "POST",
76960
- operationId: "publish_api_v1_subscriptions__provider___dataset___asset_id___post",
76961
- summary: "Publish data to Corva Subscriptions Server.",
76962
- description: "Publish data to **Corva Subscriptions Server** channel named `{provider}/{dataset}/{asset_id}`.",
78616
+ path: "/api/legacy/v1/data",
78617
+ method: "GET",
78618
+ operationId: "index_without_provider_api_legacy_v1_data_get",
78619
+ summary: "Index Without Provider",
76963
78620
  tags: [
76964
- "data"
78621
+ "legacy-data"
78622
+ ],
78623
+ parameters: [
78624
+ ],
78625
+ responses: {
78626
+ "200": {
78627
+ description: "Successful Response",
78628
+ schema: "any"
78629
+ }
78630
+ }
78631
+ },
78632
+ {
78633
+ path: "/api/legacy/v1/data/{provider}",
78634
+ method: "GET",
78635
+ operationId: "index_without_dataset_api_legacy_v1_data__provider__get",
78636
+ summary: "Index Without Dataset",
78637
+ tags: [
78638
+ "legacy-data"
78639
+ ],
78640
+ parameters: [
78641
+ {
78642
+ name: "provider",
78643
+ "in": "path",
78644
+ type: "string",
78645
+ required: true,
78646
+ description: ""
78647
+ }
78648
+ ],
78649
+ responses: {
78650
+ "200": {
78651
+ description: "Successful Response",
78652
+ schema: "any"
78653
+ },
78654
+ "422": {
78655
+ description: "Validation Error",
78656
+ schema: "{ code: number, message: string }"
78657
+ }
78658
+ }
78659
+ },
78660
+ {
78661
+ path: "/api/legacy/v1/data/{provider}/{dataset}",
78662
+ method: "GET",
78663
+ operationId: "index_api_legacy_v1_data__provider___dataset__get",
78664
+ summary: "Index",
78665
+ tags: [
78666
+ "legacy-data"
76965
78667
  ],
76966
78668
  parameters: [
76967
78669
  {
@@ -76977,23 +78679,54 @@ var clientsData = [
76977
78679
  type: "string",
76978
78680
  required: true,
76979
78681
  description: ""
78682
+ }
78683
+ ],
78684
+ responses: {
78685
+ "200": {
78686
+ description: "Successful Response",
78687
+ schema: "any"
76980
78688
  },
78689
+ "422": {
78690
+ description: "Validation Error",
78691
+ schema: "{ code: number, message: string }"
78692
+ }
78693
+ }
78694
+ },
78695
+ {
78696
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
78697
+ method: "GET",
78698
+ operationId: "show_api_legacy_v1_data__provider___dataset___id__get",
78699
+ summary: "Show",
78700
+ tags: [
78701
+ "legacy-data"
78702
+ ],
78703
+ parameters: [
76981
78704
  {
76982
- name: "asset_id",
78705
+ name: "provider",
76983
78706
  "in": "path",
76984
- type: "number",
78707
+ type: "string",
78708
+ required: true,
78709
+ description: ""
78710
+ },
78711
+ {
78712
+ name: "dataset",
78713
+ "in": "path",
78714
+ type: "string",
78715
+ required: true,
78716
+ description: ""
78717
+ },
78718
+ {
78719
+ name: "id",
78720
+ "in": "path",
78721
+ type: "string",
76985
78722
  required: true,
76986
78723
  description: ""
76987
78724
  }
76988
78725
  ],
76989
- requestBody: {
76990
- contentType: "application/json",
76991
- schema: "object | object[]",
76992
- required: true
76993
- },
76994
78726
  responses: {
76995
- "204": {
76996
- description: "Successful Response"
78727
+ "200": {
78728
+ description: "Successful Response",
78729
+ schema: "any"
76997
78730
  },
76998
78731
  "422": {
76999
78732
  description: "Validation Error",
@@ -77002,27 +78735,36 @@ var clientsData = [
77002
78735
  }
77003
78736
  },
77004
78737
  {
77005
- path: "/v1/message_producer/{app_key}",
77006
- method: "POST",
77007
- operationId: "produce_v1_message_producer__app_key__post",
77008
- summary: "Produce Messages (corva-api compatibility)",
78738
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
78739
+ method: "PUT",
78740
+ operationId: "put_api_legacy_v1_data__provider___dataset___id__put",
78741
+ summary: "Put",
77009
78742
  tags: [
77010
- "data"
78743
+ "legacy-data"
77011
78744
  ],
77012
78745
  parameters: [
77013
78746
  {
77014
- name: "app_key",
78747
+ name: "provider",
77015
78748
  "in": "path",
77016
- type: "string | null",
78749
+ type: "string",
78750
+ required: true,
78751
+ description: ""
78752
+ },
78753
+ {
78754
+ name: "dataset",
78755
+ "in": "path",
78756
+ type: "string",
78757
+ required: true,
78758
+ description: ""
78759
+ },
78760
+ {
78761
+ name: "id",
78762
+ "in": "path",
78763
+ type: "string",
77017
78764
  required: true,
77018
78765
  description: ""
77019
78766
  }
77020
78767
  ],
77021
- requestBody: {
77022
- contentType: "application/json",
77023
- schema: "{ app_connection_id: number | null, data: { timestamp: object, collection: object }[] | { timestamp: object, collection: object, measured_depth: object }[] | null, force_schedules: boolean, produce_as: string | null, rerun_begins: number | null, ... }",
77024
- required: true
77025
- },
77026
78768
  responses: {
77027
78769
  "200": {
77028
78770
  description: "Successful Response",
@@ -77035,27 +78777,36 @@ var clientsData = [
77035
78777
  }
77036
78778
  },
77037
78779
  {
77038
- path: "/v1/message_producer/",
77039
- method: "POST",
77040
- operationId: "produce_v1_message_producer__post",
77041
- summary: "Produce Messages",
78780
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
78781
+ method: "PATCH",
78782
+ operationId: "patch_api_legacy_v1_data__provider___dataset___id__patch",
78783
+ summary: "Patch",
77042
78784
  tags: [
77043
- "data"
78785
+ "legacy-data"
77044
78786
  ],
77045
78787
  parameters: [
77046
78788
  {
77047
- name: "app_key",
77048
- "in": "query",
77049
- type: "string | null",
77050
- required: false,
78789
+ name: "provider",
78790
+ "in": "path",
78791
+ type: "string",
78792
+ required: true,
78793
+ description: ""
78794
+ },
78795
+ {
78796
+ name: "dataset",
78797
+ "in": "path",
78798
+ type: "string",
78799
+ required: true,
78800
+ description: ""
78801
+ },
78802
+ {
78803
+ name: "id",
78804
+ "in": "path",
78805
+ type: "string",
78806
+ required: true,
77051
78807
  description: ""
77052
78808
  }
77053
78809
  ],
77054
- requestBody: {
77055
- contentType: "application/json",
77056
- schema: "{ app_connection_id: number | null, data: { timestamp: object, collection: object }[] | { timestamp: object, collection: object, measured_depth: object }[] | null, force_schedules: boolean, produce_as: string | null, rerun_begins: number | null, ... }",
77057
- required: true
77058
- },
77059
78810
  responses: {
77060
78811
  "200": {
77061
78812
  description: "Successful Response",
@@ -77794,6 +79545,93 @@ var clientsData = [
77794
79545
  }
77795
79546
  }
77796
79547
  },
79548
+ {
79549
+ path: "/api/v1/data/{provider}/{source_collection}/aggregate_summary/",
79550
+ method: "POST",
79551
+ operationId: "aggregate_summary_return_api_v1_data__provider___source_collection__aggregate_summary__post",
79552
+ summary: "Aggregate summary data by intervals and return results",
79553
+ tags: [
79554
+ "data"
79555
+ ],
79556
+ parameters: [
79557
+ {
79558
+ name: "provider",
79559
+ "in": "path",
79560
+ type: "string",
79561
+ required: true,
79562
+ description: ""
79563
+ },
79564
+ {
79565
+ name: "source_collection",
79566
+ "in": "path",
79567
+ type: "string",
79568
+ required: true,
79569
+ description: ""
79570
+ }
79571
+ ],
79572
+ requestBody: {
79573
+ contentType: "application/json",
79574
+ schema: "{ match_field: string, operations: \"median\" | \"avg\" | \"min\" | \"max\"[], intervals: { start: number, end: number }[], asset_id: number, exclude_data_fields: string[] }",
79575
+ required: true
79576
+ },
79577
+ responses: {
79578
+ "200": {
79579
+ description: "Successful Response",
79580
+ schema: "object[]"
79581
+ },
79582
+ "422": {
79583
+ description: "Validation Error",
79584
+ schema: "{ code: number, message: string }"
79585
+ }
79586
+ }
79587
+ },
79588
+ {
79589
+ path: "/api/v1/data/{provider}/{source_collection}/aggregate_summary/{target_collection}/",
79590
+ method: "POST",
79591
+ operationId: "aggregate_summary_upsert_api_v1_data__provider___source_collection__aggregate_summary__target_collection___post",
79592
+ summary: "Aggregate summary data by intervals and upsert results into target collection",
79593
+ tags: [
79594
+ "data"
79595
+ ],
79596
+ parameters: [
79597
+ {
79598
+ name: "provider",
79599
+ "in": "path",
79600
+ type: "string",
79601
+ required: true,
79602
+ description: ""
79603
+ },
79604
+ {
79605
+ name: "source_collection",
79606
+ "in": "path",
79607
+ type: "string",
79608
+ required: true,
79609
+ description: ""
79610
+ },
79611
+ {
79612
+ name: "target_collection",
79613
+ "in": "path",
79614
+ type: "string",
79615
+ required: true,
79616
+ description: ""
79617
+ }
79618
+ ],
79619
+ requestBody: {
79620
+ contentType: "application/json",
79621
+ schema: "{ match_field: string, operations: \"median\" | \"avg\" | \"min\" | \"max\"[], intervals: { start: number, end: number }[], asset_id: number, exclude_data_fields: string[], ... }",
79622
+ required: true
79623
+ },
79624
+ responses: {
79625
+ "200": {
79626
+ description: "Successful Response",
79627
+ schema: "object[]"
79628
+ },
79629
+ "422": {
79630
+ description: "Validation Error",
79631
+ schema: "{ code: number, message: string }"
79632
+ }
79633
+ }
79634
+ },
77797
79635
  {
77798
79636
  path: "/api/v1/message_producer/",
77799
79637
  method: "POST",
@@ -78259,7 +80097,122 @@ var clientsData = [
78259
80097
  responses: {
78260
80098
  "200": {
78261
80099
  description: "Successful Response",
78262
- schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80100
+ schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80101
+ },
80102
+ "422": {
80103
+ description: "Validation Error",
80104
+ schema: "{ code: number, message: string }"
80105
+ }
80106
+ }
80107
+ },
80108
+ {
80109
+ path: "/api/v1/dataset/{provider}/{name}/",
80110
+ method: "POST",
80111
+ operationId: "create_api_v1_dataset__provider___name___post",
80112
+ summary: "Create Dataset",
80113
+ tags: [
80114
+ "datasets"
80115
+ ],
80116
+ parameters: [
80117
+ {
80118
+ name: "provider",
80119
+ "in": "path",
80120
+ type: "string",
80121
+ required: true,
80122
+ description: ""
80123
+ },
80124
+ {
80125
+ name: "name",
80126
+ "in": "path",
80127
+ type: "string",
80128
+ required: true,
80129
+ description: ""
80130
+ }
80131
+ ],
80132
+ requestBody: {
80133
+ contentType: "application/json",
80134
+ schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }",
80135
+ required: true
80136
+ },
80137
+ responses: {
80138
+ "200": {
80139
+ description: "Successful Response",
80140
+ schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80141
+ },
80142
+ "422": {
80143
+ description: "Validation Error",
80144
+ schema: "{ code: number, message: string }"
80145
+ }
80146
+ }
80147
+ },
80148
+ {
80149
+ path: "/api/v1/dataset/{provider}/{name}/",
80150
+ method: "PATCH",
80151
+ operationId: "update_api_v1_dataset__provider___name___patch",
80152
+ summary: "Update Dataset",
80153
+ tags: [
80154
+ "datasets"
80155
+ ],
80156
+ parameters: [
80157
+ {
80158
+ name: "provider",
80159
+ "in": "path",
80160
+ type: "string",
80161
+ required: true,
80162
+ description: ""
80163
+ },
80164
+ {
80165
+ name: "name",
80166
+ "in": "path",
80167
+ type: "string",
80168
+ required: true,
80169
+ description: ""
80170
+ }
80171
+ ],
80172
+ requestBody: {
80173
+ contentType: "application/json",
80174
+ schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }",
80175
+ required: true
80176
+ },
80177
+ responses: {
80178
+ "200": {
80179
+ description: "Successful Response",
80180
+ schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80181
+ },
80182
+ "422": {
80183
+ description: "Validation Error",
80184
+ schema: "{ code: number, message: string }"
80185
+ }
80186
+ }
80187
+ },
80188
+ {
80189
+ path: "/api/v1/dataset/{provider}/{name}/",
80190
+ method: "DELETE",
80191
+ operationId: "delete_api_v1_dataset__provider___name___delete",
80192
+ summary: "Delete Dataset",
80193
+ tags: [
80194
+ "datasets"
80195
+ ],
80196
+ parameters: [
80197
+ {
80198
+ name: "provider",
80199
+ "in": "path",
80200
+ type: "string",
80201
+ required: true,
80202
+ description: ""
80203
+ },
80204
+ {
80205
+ name: "name",
80206
+ "in": "path",
80207
+ type: "string",
80208
+ required: true,
80209
+ description: ""
80210
+ }
80211
+ ],
80212
+ responses: {
80213
+ "200": {
80214
+ description: "Successful Response",
80215
+ schema: "any"
78263
80216
  },
78264
80217
  "422": {
78265
80218
  description: "Validation Error",
@@ -78268,13 +80221,95 @@ var clientsData = [
78268
80221
  }
78269
80222
  },
78270
80223
  {
78271
- path: "/api/v1/dataset/{provider}/{name}/",
78272
- method: "POST",
78273
- operationId: "create_api_v1_dataset__provider___name___post",
78274
- summary: "Create Dataset",
80224
+ path: "/api/v1/dataset/company/",
80225
+ method: "GET",
80226
+ operationId: "by_company_api_v1_dataset_company__get",
80227
+ summary: "Get Datasets By Company",
78275
80228
  tags: [
78276
80229
  "datasets"
78277
80230
  ],
80231
+ parameters: [
80232
+ {
80233
+ name: "plottable",
80234
+ "in": "query",
80235
+ type: "boolean | null",
80236
+ required: false,
80237
+ description: "Filter by plottable datasets"
80238
+ },
80239
+ {
80240
+ name: "type",
80241
+ "in": "query",
80242
+ type: "\"time\" | \"depth\" | \"reference\" | \"timeseries\" | null",
80243
+ required: false,
80244
+ description: "Filter by dataset type: time, depth, reference"
80245
+ }
80246
+ ],
80247
+ responses: {
80248
+ "200": {
80249
+ description: "Successful Response",
80250
+ schema: "object"
80251
+ },
80252
+ "422": {
80253
+ description: "Validation Error",
80254
+ schema: "{ code: number, message: string }"
80255
+ }
80256
+ }
80257
+ }
80258
+ ],
80259
+ "legacy-data": [
80260
+ {
80261
+ path: "/api/legacy/v1/data",
80262
+ method: "GET",
80263
+ operationId: "index_without_provider_api_legacy_v1_data_get",
80264
+ summary: "Index Without Provider",
80265
+ tags: [
80266
+ "legacy-data"
80267
+ ],
80268
+ parameters: [
80269
+ ],
80270
+ responses: {
80271
+ "200": {
80272
+ description: "Successful Response",
80273
+ schema: "any"
80274
+ }
80275
+ }
80276
+ },
80277
+ {
80278
+ path: "/api/legacy/v1/data/{provider}",
80279
+ method: "GET",
80280
+ operationId: "index_without_dataset_api_legacy_v1_data__provider__get",
80281
+ summary: "Index Without Dataset",
80282
+ tags: [
80283
+ "legacy-data"
80284
+ ],
80285
+ parameters: [
80286
+ {
80287
+ name: "provider",
80288
+ "in": "path",
80289
+ type: "string",
80290
+ required: true,
80291
+ description: ""
80292
+ }
80293
+ ],
80294
+ responses: {
80295
+ "200": {
80296
+ description: "Successful Response",
80297
+ schema: "any"
80298
+ },
80299
+ "422": {
80300
+ description: "Validation Error",
80301
+ schema: "{ code: number, message: string }"
80302
+ }
80303
+ }
80304
+ },
80305
+ {
80306
+ path: "/api/legacy/v1/data/{provider}/{dataset}",
80307
+ method: "GET",
80308
+ operationId: "index_api_legacy_v1_data__provider___dataset__get",
80309
+ summary: "Index",
80310
+ tags: [
80311
+ "legacy-data"
80312
+ ],
78278
80313
  parameters: [
78279
80314
  {
78280
80315
  name: "provider",
@@ -78284,22 +80319,17 @@ var clientsData = [
78284
80319
  description: ""
78285
80320
  },
78286
80321
  {
78287
- name: "name",
80322
+ name: "dataset",
78288
80323
  "in": "path",
78289
80324
  type: "string",
78290
80325
  required: true,
78291
80326
  description: ""
78292
80327
  }
78293
80328
  ],
78294
- requestBody: {
78295
- contentType: "application/json",
78296
- schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }",
78297
- required: true
78298
- },
78299
80329
  responses: {
78300
80330
  "200": {
78301
80331
  description: "Successful Response",
78302
- schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80332
+ schema: "any"
78303
80333
  },
78304
80334
  "422": {
78305
80335
  description: "Validation Error",
@@ -78308,12 +80338,12 @@ var clientsData = [
78308
80338
  }
78309
80339
  },
78310
80340
  {
78311
- path: "/api/v1/dataset/{provider}/{name}/",
78312
- method: "PATCH",
78313
- operationId: "update_api_v1_dataset__provider___name___patch",
78314
- summary: "Update Dataset",
80341
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
80342
+ method: "GET",
80343
+ operationId: "show_api_legacy_v1_data__provider___dataset___id__get",
80344
+ summary: "Show",
78315
80345
  tags: [
78316
- "datasets"
80346
+ "legacy-data"
78317
80347
  ],
78318
80348
  parameters: [
78319
80349
  {
@@ -78324,22 +80354,24 @@ var clientsData = [
78324
80354
  description: ""
78325
80355
  },
78326
80356
  {
78327
- name: "name",
80357
+ name: "dataset",
80358
+ "in": "path",
80359
+ type: "string",
80360
+ required: true,
80361
+ description: ""
80362
+ },
80363
+ {
80364
+ name: "id",
78328
80365
  "in": "path",
78329
80366
  type: "string",
78330
80367
  required: true,
78331
80368
  description: ""
78332
80369
  }
78333
80370
  ],
78334
- requestBody: {
78335
- contentType: "application/json",
78336
- schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }",
78337
- required: true
78338
- },
78339
80371
  responses: {
78340
80372
  "200": {
78341
80373
  description: "Successful Response",
78342
- schema: "{ company_id: number | null, provider: string, name: string, description: string | null, schema: object, ... }"
80374
+ schema: "any"
78343
80375
  },
78344
80376
  "422": {
78345
80377
  description: "Validation Error",
@@ -78348,12 +80380,12 @@ var clientsData = [
78348
80380
  }
78349
80381
  },
78350
80382
  {
78351
- path: "/api/v1/dataset/{provider}/{name}/",
78352
- method: "DELETE",
78353
- operationId: "delete_api_v1_dataset__provider___name___delete",
78354
- summary: "Delete Dataset",
80383
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
80384
+ method: "PUT",
80385
+ operationId: "put_api_legacy_v1_data__provider___dataset___id__put",
80386
+ summary: "Put",
78355
80387
  tags: [
78356
- "datasets"
80388
+ "legacy-data"
78357
80389
  ],
78358
80390
  parameters: [
78359
80391
  {
@@ -78364,7 +80396,14 @@ var clientsData = [
78364
80396
  description: ""
78365
80397
  },
78366
80398
  {
78367
- name: "name",
80399
+ name: "dataset",
80400
+ "in": "path",
80401
+ type: "string",
80402
+ required: true,
80403
+ description: ""
80404
+ },
80405
+ {
80406
+ name: "id",
78368
80407
  "in": "path",
78369
80408
  type: "string",
78370
80409
  required: true,
@@ -78383,33 +80422,40 @@ var clientsData = [
78383
80422
  }
78384
80423
  },
78385
80424
  {
78386
- path: "/api/v1/dataset/company/",
78387
- method: "GET",
78388
- operationId: "by_company_api_v1_dataset_company__get",
78389
- summary: "Get Datasets By Company",
80425
+ path: "/api/legacy/v1/data/{provider}/{dataset}/{id}",
80426
+ method: "PATCH",
80427
+ operationId: "patch_api_legacy_v1_data__provider___dataset___id__patch",
80428
+ summary: "Patch",
78390
80429
  tags: [
78391
- "datasets"
80430
+ "legacy-data"
78392
80431
  ],
78393
80432
  parameters: [
78394
80433
  {
78395
- name: "plottable",
78396
- "in": "query",
78397
- type: "boolean | null",
78398
- required: false,
78399
- description: "Filter by plottable datasets"
80434
+ name: "provider",
80435
+ "in": "path",
80436
+ type: "string",
80437
+ required: true,
80438
+ description: ""
78400
80439
  },
78401
80440
  {
78402
- name: "type",
78403
- "in": "query",
78404
- type: "\"time\" | \"depth\" | \"reference\" | \"timeseries\" | null",
78405
- required: false,
78406
- description: "Filter by dataset type: time, depth, reference"
80441
+ name: "dataset",
80442
+ "in": "path",
80443
+ type: "string",
80444
+ required: true,
80445
+ description: ""
80446
+ },
80447
+ {
80448
+ name: "id",
80449
+ "in": "path",
80450
+ type: "string",
80451
+ required: true,
80452
+ description: ""
78407
80453
  }
78408
80454
  ],
78409
80455
  responses: {
78410
80456
  "200": {
78411
80457
  description: "Successful Response",
78412
- schema: "object"
80458
+ schema: "any"
78413
80459
  },
78414
80460
  "422": {
78415
80461
  description: "Validation Error",
@@ -82970,6 +85016,270 @@ var entries = [
82970
85016
  importPath: "@corva/ui/components",
82971
85017
  searchText: "casing casing"
82972
85018
  },
85019
+ {
85020
+ id: "component-v1-ChartButton",
85021
+ type: "component",
85022
+ name: "ChartButton",
85023
+ description: "ChartButton — chart button for the Chart family. See the Chart story for canonical usage.",
85024
+ keywords: [
85025
+ "chartbutton",
85026
+ "chart",
85027
+ "button",
85028
+ "family.",
85029
+ "story",
85030
+ "canonical",
85031
+ "usage."
85032
+ ],
85033
+ tags: [
85034
+ "v1"
85035
+ ],
85036
+ category: "components-v1",
85037
+ importPath: "@corva/ui/components",
85038
+ searchText: "chartbutton chartbutton — chart button for the chart family. see the chart story for canonical usage. chartbutton chart button family. story canonical usage."
85039
+ },
85040
+ {
85041
+ id: "component-v1-ChartButtons",
85042
+ type: "component",
85043
+ name: "ChartButtons",
85044
+ description: "ChartButtons — chart buttons for the Chart family. See the Chart story for canonical usage.",
85045
+ keywords: [
85046
+ "chartbuttons",
85047
+ "chart",
85048
+ "buttons",
85049
+ "family.",
85050
+ "story",
85051
+ "canonical",
85052
+ "usage."
85053
+ ],
85054
+ tags: [
85055
+ "v1"
85056
+ ],
85057
+ category: "components-v1",
85058
+ importPath: "@corva/ui/components",
85059
+ searchText: "chartbuttons chartbuttons — chart buttons for the chart family. see the chart story for canonical usage. chartbuttons chart buttons family. story canonical usage."
85060
+ },
85061
+ {
85062
+ id: "component-v1-ChartWrapper",
85063
+ type: "component",
85064
+ name: "ChartWrapper",
85065
+ description: "ChartWrapper — chart wrapper for the Chart family. See the Chart story for canonical usage.",
85066
+ keywords: [
85067
+ "chartwrapper",
85068
+ "chart",
85069
+ "wrapper",
85070
+ "family.",
85071
+ "story",
85072
+ "canonical",
85073
+ "usage."
85074
+ ],
85075
+ tags: [
85076
+ "v1"
85077
+ ],
85078
+ category: "components-v1",
85079
+ importPath: "@corva/ui/components",
85080
+ searchText: "chartwrapper chartwrapper — chart wrapper for the chart family. see the chart story for canonical usage. chartwrapper chart wrapper family. story canonical usage."
85081
+ },
85082
+ {
85083
+ id: "component-v1-AxisDropdown",
85084
+ type: "component",
85085
+ name: "AxisDropdown",
85086
+ description: "AxisDropdown — axis dropdown for the Chart family. See the Chart story for canonical usage.",
85087
+ keywords: [
85088
+ "axisdropdown",
85089
+ "axis",
85090
+ "dropdown",
85091
+ "chart",
85092
+ "family.",
85093
+ "story",
85094
+ "canonical",
85095
+ "usage."
85096
+ ],
85097
+ tags: [
85098
+ "v1"
85099
+ ],
85100
+ category: "components-v1",
85101
+ importPath: "@corva/ui/components",
85102
+ searchText: "axisdropdown axisdropdown — axis dropdown for the chart family. see the chart story for canonical usage. axisdropdown axis dropdown chart family. story canonical usage."
85103
+ },
85104
+ {
85105
+ id: "component-v1-ChartSelect",
85106
+ type: "component",
85107
+ name: "ChartSelect",
85108
+ description: "ChartSelect — chart select for the Chart family. See the Chart story for canonical usage.",
85109
+ keywords: [
85110
+ "chartselect",
85111
+ "chart",
85112
+ "select",
85113
+ "family.",
85114
+ "story",
85115
+ "canonical",
85116
+ "usage."
85117
+ ],
85118
+ tags: [
85119
+ "v1"
85120
+ ],
85121
+ category: "components-v1",
85122
+ importPath: "@corva/ui/components",
85123
+ searchText: "chartselect chartselect — chart select for the chart family. see the chart story for canonical usage. chartselect chart select family. story canonical usage."
85124
+ },
85125
+ {
85126
+ id: "component-v1-DragToZoomButton",
85127
+ type: "component",
85128
+ name: "DragToZoomButton",
85129
+ description: "DragToZoomButton — drag to zoom button for the Chart family. See the Chart story for canonical usage.",
85130
+ keywords: [
85131
+ "dragtozoombutton",
85132
+ "drag",
85133
+ "zoom",
85134
+ "button",
85135
+ "chart",
85136
+ "family.",
85137
+ "story",
85138
+ "canonical",
85139
+ "usage."
85140
+ ],
85141
+ tags: [
85142
+ "v1"
85143
+ ],
85144
+ category: "components-v1",
85145
+ importPath: "@corva/ui/components",
85146
+ searchText: "dragtozoombutton dragtozoombutton — drag to zoom button for the chart family. see the chart story for canonical usage. dragtozoombutton drag zoom button chart family. story canonical usage."
85147
+ },
85148
+ {
85149
+ id: "component-v1-ZoomInButton",
85150
+ type: "component",
85151
+ name: "ZoomInButton",
85152
+ description: "ZoomInButton — zoom in button for the Chart family. See the Chart story for canonical usage.",
85153
+ keywords: [
85154
+ "zoominbutton",
85155
+ "zoom",
85156
+ "button",
85157
+ "chart",
85158
+ "family.",
85159
+ "story",
85160
+ "canonical",
85161
+ "usage."
85162
+ ],
85163
+ tags: [
85164
+ "v1"
85165
+ ],
85166
+ category: "components-v1",
85167
+ importPath: "@corva/ui/components",
85168
+ searchText: "zoominbutton zoominbutton — zoom in button for the chart family. see the chart story for canonical usage. zoominbutton zoom button chart family. story canonical usage."
85169
+ },
85170
+ {
85171
+ id: "component-v1-ZoomOutButton",
85172
+ type: "component",
85173
+ name: "ZoomOutButton",
85174
+ description: "ZoomOutButton — zoom out button for the Chart family. See the Chart story for canonical usage.",
85175
+ keywords: [
85176
+ "zoomoutbutton",
85177
+ "zoom",
85178
+ "button",
85179
+ "chart",
85180
+ "family.",
85181
+ "story",
85182
+ "canonical",
85183
+ "usage.",
85184
+ "out"
85185
+ ],
85186
+ tags: [
85187
+ "v1"
85188
+ ],
85189
+ category: "components-v1",
85190
+ importPath: "@corva/ui/components",
85191
+ searchText: "zoomoutbutton zoomoutbutton — zoom out button for the chart family. see the chart story for canonical usage. zoomoutbutton zoom button chart family. story canonical usage. out"
85192
+ },
85193
+ {
85194
+ id: "component-v1-PanButton",
85195
+ type: "component",
85196
+ name: "PanButton",
85197
+ description: "PanButton — pan button for the Chart family. See the Chart story for canonical usage.",
85198
+ keywords: [
85199
+ "panbutton",
85200
+ "button",
85201
+ "chart",
85202
+ "family.",
85203
+ "story",
85204
+ "canonical",
85205
+ "usage.",
85206
+ "pan"
85207
+ ],
85208
+ tags: [
85209
+ "v1"
85210
+ ],
85211
+ category: "components-v1",
85212
+ importPath: "@corva/ui/components",
85213
+ searchText: "panbutton panbutton — pan button for the chart family. see the chart story for canonical usage. panbutton button chart family. story canonical usage. pan"
85214
+ },
85215
+ {
85216
+ id: "component-v1-ResetZoomButton",
85217
+ type: "component",
85218
+ name: "ResetZoomButton",
85219
+ description: "ResetZoomButton — reset zoom button for the Chart family. See the Chart story for canonical usage.",
85220
+ keywords: [
85221
+ "resetzoombutton",
85222
+ "reset",
85223
+ "zoom",
85224
+ "button",
85225
+ "chart",
85226
+ "family.",
85227
+ "story",
85228
+ "canonical",
85229
+ "usage."
85230
+ ],
85231
+ tags: [
85232
+ "v1"
85233
+ ],
85234
+ category: "components-v1",
85235
+ importPath: "@corva/ui/components",
85236
+ searchText: "resetzoombutton resetzoombutton — reset zoom button for the chart family. see the chart story for canonical usage. resetzoombutton reset zoom button chart family. story canonical usage."
85237
+ },
85238
+ {
85239
+ id: "component-v1-HideAxesButton",
85240
+ type: "component",
85241
+ name: "HideAxesButton",
85242
+ description: "HideAxesButton — hide axes button for the Chart family. See the Chart story for canonical usage.",
85243
+ keywords: [
85244
+ "hideaxesbutton",
85245
+ "hide",
85246
+ "axes",
85247
+ "button",
85248
+ "chart",
85249
+ "family.",
85250
+ "story",
85251
+ "canonical",
85252
+ "usage."
85253
+ ],
85254
+ tags: [
85255
+ "v1"
85256
+ ],
85257
+ category: "components-v1",
85258
+ importPath: "@corva/ui/components",
85259
+ searchText: "hideaxesbutton hideaxesbutton — hide axes button for the chart family. see the chart story for canonical usage. hideaxesbutton hide axes button chart family. story canonical usage."
85260
+ },
85261
+ {
85262
+ id: "component-v1-ChartTypeButton",
85263
+ type: "component",
85264
+ name: "ChartTypeButton",
85265
+ description: "ChartTypeButton — chart type button for the Chart family. See the Chart story for canonical usage.",
85266
+ keywords: [
85267
+ "charttypebutton",
85268
+ "chart",
85269
+ "type",
85270
+ "button",
85271
+ "family.",
85272
+ "story",
85273
+ "canonical",
85274
+ "usage."
85275
+ ],
85276
+ tags: [
85277
+ "v1"
85278
+ ],
85279
+ category: "components-v1",
85280
+ importPath: "@corva/ui/components",
85281
+ searchText: "charttypebutton charttypebutton — chart type button for the chart family. see the chart story for canonical usage. charttypebutton chart type button family. story canonical usage."
85282
+ },
82973
85283
  {
82974
85284
  id: "component-v1-ChartActionsList",
82975
85285
  type: "component",
@@ -86926,6 +89236,13 @@ var entries = [
86926
89236
  "list",
86927
89237
  "aggregate",
86928
89238
  "pipeline",
89239
+ "aggregate_summary",
89240
+ "summary",
89241
+ "return",
89242
+ "source",
89243
+ "collection",
89244
+ "upsert",
89245
+ "target",
86929
89246
  "batch_update",
86930
89247
  "batch",
86931
89248
  "update",
@@ -86950,13 +89267,17 @@ var entries = [
86950
89267
  "key",
86951
89268
  "subscriptions",
86952
89269
  "publish",
86953
- "asset"
89270
+ "asset",
89271
+ "legacy-data",
89272
+ "legacy",
89273
+ "without",
89274
+ "show"
86954
89275
  ],
86955
89276
  tags: [
86956
89277
  ],
86957
89278
  category: "clients",
86958
89279
  importPath: "@corva/ui/clients",
86959
- searchText: "corvadataapi data api client for corva platform. used for data-specific endpoints with automatic url configuration. api data http request fetch rest metrics get v1 by provider and dataset create post replace put delete many count list aggregate pipeline batch_update batch update patch batch_update_with_object with object retrieve id datasets index company name check perform action message_producer produce message producer app key subscriptions publish asset"
89280
+ searchText: "corvadataapi data api client for corva platform. used for data-specific endpoints with automatic url configuration. api data http request fetch rest metrics get v1 by provider and dataset create post replace put delete many count list aggregate pipeline aggregate_summary summary return source collection upsert target batch_update batch update patch batch_update_with_object with object retrieve id datasets index company name check perform action message_producer produce message producer app key subscriptions publish asset legacy-data legacy without show"
86960
89281
  },
86961
89282
  {
86962
89283
  id: "client-socketClient",
@@ -93096,6 +95417,18 @@ var byCategory = {
93096
95417
  "component-v1-Breadcrumbs",
93097
95418
  "component-v1-Button",
93098
95419
  "component-v1-Casing",
95420
+ "component-v1-ChartButton",
95421
+ "component-v1-ChartButtons",
95422
+ "component-v1-ChartWrapper",
95423
+ "component-v1-AxisDropdown",
95424
+ "component-v1-ChartSelect",
95425
+ "component-v1-DragToZoomButton",
95426
+ "component-v1-ZoomInButton",
95427
+ "component-v1-ZoomOutButton",
95428
+ "component-v1-PanButton",
95429
+ "component-v1-ResetZoomButton",
95430
+ "component-v1-HideAxesButton",
95431
+ "component-v1-ChartTypeButton",
93099
95432
  "component-v1-ChartActionsList",
93100
95433
  "component-v1-Checkbox",
93101
95434
  "component-v1-Chip",
@@ -95073,7 +97406,9 @@ Examples:
95073
97406
  - "button" - find button components
95074
97407
  - "loading spinner" - find loading indicators
95075
97408
  - "date picker" - find date/time components
95076
- - "useSubscriptions" - find specific hook`;
97409
+ - "useSubscriptions" - find specific hook
97410
+
97411
+ When category is 'v2' or 'v1' and the requested version has no match, the response surfaces a labeled fallback block from the other version so a single search still discovers a candidate. The agent should still prefer V2 when both versions match.`;
95077
97412
  const searchToolSchema = {
95078
97413
  query: z.string().describe('Search query - component name, use case, or description'),
95079
97414
  type: z
@@ -95105,18 +97440,16 @@ const handleSearch = (args) => {
95105
97440
  const rawWords = queryLower.trim().split(/\s+/);
95106
97441
  const queryWords = rawWords.filter(w => w.length > 1);
95107
97442
  const isMultiWord = rawWords.length >= 2 && queryWords.length >= 2;
95108
- let results = [];
97443
+ // When the query has filler words around a single meaningful word (e.g. "a button"),
97444
+ // the single-word path should match against just that word instead of the whole query.
97445
+ const singleWordQuery = !isMultiWord && queryWords.length === 1 ? queryWords[0] : queryLower;
95109
97446
  // Filter by type
95110
97447
  let { entries } = searchIndex;
95111
97448
  if (type !== 'all') {
95112
97449
  entries = entries.filter(e => e.type === type);
95113
97450
  }
95114
- // Filter by category for components
95115
- if (category !== 'all') {
95116
- const fullCategory = category.startsWith('components-') ? category : `components-${category}`;
95117
- entries = entries.filter(e => e.type !== 'component' || e.category === fullCategory);
95118
- }
95119
- // Score and sort results using SEARCH_CONFIG weights
97451
+ // Category filtering happens AFTER scoring so we can surface a V2↔V1 fallback
97452
+ // block when the requested category is empty but the other version has hits.
95120
97453
  const { weights, boosts } = SEARCH_CONFIG;
95121
97454
  const scored = entries.map(entry => {
95122
97455
  let score = 0;
@@ -95125,62 +97458,87 @@ const handleSearch = (args) => {
95125
97458
  }
95126
97459
  else {
95127
97460
  // Exact name match (highest priority)
95128
- if (entry.name.toLowerCase() === queryLower) {
97461
+ if (entry.name.toLowerCase() === singleWordQuery) {
95129
97462
  score += weights.exactMatch;
95130
97463
  }
95131
97464
  // Name starts with query
95132
- else if (entry.name.toLowerCase().startsWith(queryLower)) {
97465
+ else if (entry.name.toLowerCase().startsWith(singleWordQuery)) {
95133
97466
  score += weights.startsWith;
95134
97467
  }
95135
97468
  // Name contains query
95136
- else if (entry.name.toLowerCase().includes(queryLower)) {
97469
+ else if (entry.name.toLowerCase().includes(singleWordQuery)) {
95137
97470
  score += weights.contains;
95138
97471
  }
95139
97472
  // Keyword match
95140
97473
  score += entry.keywords.reduce((keywordScore, keyword) => {
95141
- if (keyword === queryLower) {
97474
+ if (keyword === singleWordQuery) {
95142
97475
  return keywordScore + weights.keywordExact;
95143
97476
  }
95144
- if (keyword.includes(queryLower)) {
97477
+ if (keyword.includes(singleWordQuery)) {
95145
97478
  return keywordScore + weights.keywordContains;
95146
97479
  }
95147
97480
  return keywordScore;
95148
97481
  }, 0);
95149
97482
  // Description match
95150
- if (entry.description.toLowerCase().includes(queryLower)) {
97483
+ if (entry.description.toLowerCase().includes(singleWordQuery)) {
95151
97484
  score += weights.description;
95152
97485
  }
95153
97486
  // Full text match
95154
- if (entry.searchText.includes(queryLower)) {
97487
+ if (entry.searchText.includes(singleWordQuery)) {
95155
97488
  score += weights.fullText;
95156
97489
  }
95157
97490
  }
95158
- // Boost V2 components
95159
- if (entry.category === 'components-v2') {
97491
+ // Boost V2 components — but only when the entry actually matched the query.
97492
+ // Adding the boost to a 0-score entry would make every V2 component appear
97493
+ // as a "result" and prevent the V1 fallback from ever firing.
97494
+ if (score > 0 && entry.category === 'components-v2') {
95160
97495
  score += boosts.v2Component;
95161
97496
  }
95162
97497
  return { entry, score };
95163
97498
  });
95164
- results = scored
97499
+ const ranked = scored
95165
97500
  .filter(s => s.score > 0)
95166
97501
  .sort((a, b) => b.score - a.score)
95167
- .slice(0, limit)
95168
97502
  .map(s => s.entry);
95169
- if (results.length === 0) {
97503
+ let requestedCategory = null;
97504
+ if (category !== 'all') {
97505
+ requestedCategory = category.startsWith('components-') ? category : `components-${category}`;
97506
+ }
97507
+ const matchesRequested = (entry) => requestedCategory === null ||
97508
+ entry.type !== 'component' ||
97509
+ entry.category === requestedCategory;
97510
+ const primary = ranked.filter(matchesRequested).slice(0, limit);
97511
+ const fallback = requestedCategory && primary.length === 0
97512
+ ? ranked
97513
+ .filter(entry => entry.type === 'component' && entry.category !== requestedCategory)
97514
+ .slice(0, limit)
97515
+ : [];
97516
+ if (primary.length === 0 && fallback.length === 0) {
95170
97517
  return {
95171
97518
  response: createToolResponse(`No results found for "${query}". Try:\n- A different search term\n- Using list_corva_ui to see available items`),
95172
97519
  resultCount: 0,
95173
97520
  };
95174
97521
  }
95175
- const formatted = results
95176
- .map(r => {
97522
+ const formatEntry = (r) => {
95177
97523
  const categoryLabel = r.type === 'component' ? ` (${r.category.replace('components-', '')})` : '';
95178
97524
  return `**${r.name}**${categoryLabel} - ${r.type}\n ${r.description || 'No description'}\n Import: \`${r.importPath}\``;
95179
- })
95180
- .join('\n\n');
97525
+ };
97526
+ if (primary.length > 0) {
97527
+ const formatted = primary.map(formatEntry).join('\n\n');
97528
+ return {
97529
+ response: createToolResponse(`Found ${primary.length} result(s) for "${query}":\n\n${formatted}`),
97530
+ resultCount: primary.length,
97531
+ };
97532
+ }
97533
+ const requestedVersion = requestedCategory.replace('components-', '').toUpperCase();
97534
+ const fallbackVersion = requestedVersion === 'V2' ? 'V1' : 'V2';
97535
+ const preferenceHint = requestedVersion === 'V2'
97536
+ ? ' V2 is preferred when available; consider these only if no V2 alternative exists.'
97537
+ : '';
97538
+ const formatted = fallback.map(formatEntry).join('\n\n');
95181
97539
  return {
95182
- response: createToolResponse(`Found ${results.length} result(s) for "${query}":\n\n${formatted}`),
95183
- resultCount: results.length,
97540
+ response: createToolResponse(`No ${requestedVersion} matches for "${query}". ${fallbackVersion} fallback — ${fallbackVersion} components that match the query.${preferenceHint}\n\n${formatted}`),
97541
+ resultCount: fallback.length,
95184
97542
  };
95185
97543
  };
95186
97544
 
@@ -95985,6 +98343,41 @@ const handleGetDiagnostics = (stats, telemetry, identity) => {
95985
98343
  };
95986
98344
  };
95987
98345
 
98346
+ // This file is auto-generated by `yarn mcp:generate-prompts`. Do not edit by hand.
98347
+ // Source: ./figma-to-code.prompt.md
98348
+ const figmaToCodePromptTemplate = "You are translating a Figma design into React components that consume the `@corva/ui` components library. Follow the\norchestration below strictly and prefer evidence from the target repo over assumptions.\n\n## Inputs\n\nUser request: {{input}}\n\nExtract the Figma URL from the user request by matching `figma.com/design/…`, `figma.com/make/…`, or\n`figma.com/board/…`. Treat the remainder as instructions (target path, file to extend, naming, behavior notes).\n\n## Precedence\n\nWhen sources of truth disagree on file layout, styling, or naming, follow this order (highest wins):\n\n1. Explicit instructions in the user request (target path, file to extend, naming).\n2. Figma Code Connect mappings returned by `mcp__figma__get_design_context`.\n3. `@corva/ui` MCP docs (`get_component_docs`, `get_theme_docs`, icon search, etc.). These are authoritative for what\n exists in the components library.\n4. `AGENTS.md` / `CLAUDE.md` in the target repo, looked up in this order and merged (earlier wins):\n a. the target directory,\n b. the nearest package root (walk up to the first `package.json`), which matters in monorepos,\n c. the repo root.\n5. 1–2 neighboring components in the target directory (fallback when 4 is silent on an axis).\n6. The minimal default policy in Step 8 (fallback when 4 and 5 are both silent).\n\n## Step 1 — Acknowledge (before any tool call)\n\nPrint one short line to the user confirming what you parsed: the Figma URL, the extracted `nodeId` and `fileKey`, and\nthe target path if stated. This is the only user-facing text until after Step 4 completes, so make it specific enough\nthat the user knows the command fired.\n\n## Step 2 — Verify Figma MCP availability\n\nBefore any other work, confirm the Figma Dev Mode MCP is active by checking whether `mcp__figma__get_design_context`\nappears in your available tools.\n\nIf the tool is NOT available:\n\n- Tell the user: \"The Figma Dev Mode MCP is not enabled in this Claude Code session. Enable it via Figma Desktop →\n Preferences → Enable Dev Mode MCP Server, then restart Claude Code and re-run `/figma_to_code`.\"\n- Stop immediately. Do not call any other tool, do not ask follow-up questions, and do not attempt to generate code\n without the design context.\n\nIf the tool IS available, proceed to the next step.\n\n## Step 3 — Resolve missing inputs\n\nIf no Figma URL is present in the user request, ask the user for it. If the target path (or file to extend) is not\nspecified, ask before generating. Do not invent a location.\n\n## Step 4 — Gather design context\n\nCall `mcp__figma__get_design_context` with the Figma URL. Inspect the response for:\n\n- Code Connect snippets / imports / designer instructions (use verbatim when present).\n- Design tokens exposed as CSS variables.\n- Screenshot and annotations.\n- Asset URLs (images, icons) that imply specific primitives.\n\nIf Code Connect coverage is unclear, `mcp__figma__get_code_connect_map` is a verification fallback.\nDo **not** call `mcp__figma__get_code_connect_suggestions`. That tool is for authoring new mappings, not codegen.\n\nIf the first `get_design_context` call returns a sparse \"too large\" response listing sublayer IDs, drill into only the\nheader, one representative row, and one content panel — do NOT recursively walk every child. A targeted sample is\nsufficient to infer the pattern for the remaining rows.\n\n## Step 5 — Read target-repo conventions\n\nBefore generating, read `AGENTS.md` / `CLAUDE.md` at precedence level 4 if present (target dir → nearest package root →\nrepo root). These files define the repo's conventions: file layout, directory structure, styling approach\n(SCSS / MUI `sx` / styled-components / CSS modules), size limits, naming, imports. Extract and apply what's relevant to\nthe target directory.\n\nIf no `AGENTS.md` / `CLAUDE.md` exists at any level, fall through to Step 8 (neighboring components).\n\nMatch the repo's documented import / module syntax (`@import` vs `@use`, named vs default exports, relative vs aliased\npaths). Do not refactor or \"modernize\" the convention as a side quest. If the documented form produces a build or type\nerror, substitute a working equivalent and list the substitution under \"Implementation deviations\" in the Gap Report so\nthe convention file can be updated.\n\n## Step 6 — Detect project mode\n\nRead `./package.json`:\n\n- `\"name\": \"@corva/ui\"` ⇒ **authoring mode**. You are contributing a new primitive to the library itself. If Step 5\n did not yield a concrete file-structure contract (target directory, file layout, export conventions), **stop and ask\n the user** where to scaffold before proceeding. Authoring a primitive in the wrong shape is worse than pausing.\n- `@corva/ui` listed in `dependencies` / `devDependencies` ⇒ **consumer mode** (default). Import from `@corva/ui` entry\n points; do not scaffold new primitives into the consumer repo.\n\n## Step 7 — Resolve @corva/ui primitives for each unmapped node\n\nPriority: **Reuse > Compose > Create**. Create a new primitive only in `@corva/ui` authoring mode (per Step 6) or when\nthe user explicitly asks. In consumer mode, always compose existing primitives — never scaffold new ones.\n\n**Search by capability, not by package name.** Before importing any third-party rendering or runtime package directly,\nsearch `@corva/ui` by capability terms drawn from the Figma node's visual and behavioral language — never let a vendor\nor library name be the decisive query. `@corva/ui` typically wraps third-party libraries (including but not limited to\ncharts, maps, code editors, virtualized lists, drag-and-drop, and rich text) behind a Corva shell whose name contains\nno library name, so queries like `highcharts` or `mapbox` return noise. Treat a Corva shell as the default hypothesis\nand disprove it with three capability search axes: (a) the user-facing widget shell (e.g. `chart container with zoom\nand pan`, `map viewport`); (b) its interaction control family (e.g. `axis dropdown`, `zoom button`,\n`chart type switch`); (c) any setup, provider, or config utility (e.g. `chart theme`, `map provider`). When a shell\nturns up, also pull in its companion controls instead of re-implementing toolbar UX. Each of the three axes must be\nqueried against both `category: 'v2'` and `category: 'v1'` — interaction-control families and shell wrappers (chart,\nmap, editor) often live only in V1, so a V2-only sweep can falsely conclude no Corva equivalent exists. A direct\nthird-party import is valid only if all three axes ran across both versions and returned no Corva equivalent — record\nthe import in the Gap Report's Implementation deviations and list the exact capability queries you ran for each\nversion, so the gap is auditable.\n\nBatch all unrelated primitive, icon, and theme lookups below into a single parallel tool call. Do not serialize them\nacross turns.\n\nFor every Figma subtree without a Code Connect hit:\n\n1. `mcp__corva-ui__search_corva_ui` with `{ query: '<descriptive term>', type: 'component', category: 'v2' }` to find\n candidate components. `query` is required; `type: 'component'` is required because category-only filtering does not\n exclude non-component entries. The tool surfaces a labeled V1 fallback block in the response when V2 has no match —\n when that block appears (or the response is \"No results\"), retry the same query with `category: 'v1'` and treat any\n hits there as candidates. Prefer V2 when both versions match; a capability is only a true gap once both V2 and V1\n have been queried explicitly.\n2. `mcp__corva-ui__get_component_docs` for each chosen component, passing the same `category` (`'v1'` or `'v2'`) that\n the search returned — names can collide across versions (e.g., `Autocomplete` exists in both). Use the returned\n import statement and prop schema verbatim. Variant values must come from the prop schema (e.g., the canonical\n union returned for `variant` or `size`); do not translate Figma variant labels (`\"Primary\"`, `\"Large\"`) by guessing.\n3. For icons: `mcp__corva-ui__search_corva_ui` with `{ query: '<icon description>', type: 'icon' }`. Import exactly the\n export name returned — naming is inconsistent (e.g., `DownSmallIcon`, `Pin`, `AttentionCustomIcon`). Do not guess a\n suffix. Use `mcp__corva-ui__list_corva_ui` with `{ type: 'icons' }` only to discover available icon sets (it lists\n sets and counts, not individual exports).\n4. For colors / spacing / typography / z-index: `mcp__corva-ui__get_theme_docs` — always use canonical token names, and\n never hard-code hex values. Express tokens through whichever mechanism the target repo's `AGENTS.md` or neighboring\n components already use (SCSS mixin, MUI `theme.*` helper, CSS custom property, Tailwind class, etc.). Match what's\n there rather than introducing a new style system.\n\n When a third-party config (chart libraries, mapping libs, canvas/WebGL code) requires palette / typography /\n semantic-color literals inline in JS/TS, do not paste Figma hex values. Source the values from `get_theme_docs`. If\n `@corva/ui` exposes a documented JS/TS theme module, import from it and cite the path. If no JS export exists,\n surface the role as an \"Unmapped token\" in the Gap Report — do not silently inline a hex. This rule does NOT apply\n to chart geometry (tick intervals, axis domains, heights, spacing) — those are domain values, not tokens.\n5. For hooks, constants, and clients implied by the design (subscriptions, feature flags, API calls, etc.):\n `mcp__corva-ui__get_hook_docs`, `mcp__corva-ui__get_constants_docs`, `mcp__corva-ui__get_client_docs`. For generic\n utilities (formatters, converters, helpers): `mcp__corva-ui__search_corva_ui` with `{ query, type: 'util' }`, or\n browse with `mcp__corva-ui__list_corva_ui({ type: 'utils' })`.\n\n## Step 8 — Fall back to neighboring components when conventions are silent\n\nIf `AGENTS.md` / `CLAUDE.md` didn't cover a given axis (styling, file layout, naming), read 1–2 neighboring components\nin the target directory and match what's already there. Do not introduce a new styling system on top of the repo's\nexisting one.\n\nIf neighbors are also inconclusive, use this minimal default policy:\n\n- **Tokens:** canonical names from `get_theme_docs`; never hard-code hex. In `.tsx`, prefer MUI `theme.*` helpers; in\n style files, prefer CSS custom properties.\n- **Component size:** prefer small, focused components. Split by responsibility when a single component starts handling\n multiple distinct concerns.\n- **Output files:** emit only what's needed to render the design. Do not generate documentation, example, or story\n files unless the user explicitly asked.\n\n## Step 9 — Generate\n\n- Emit the component file(s) at the path specified in the user's instructions (or at the location `AGENTS.md` /\n neighbors indicate).\n- Use Code Connect imports verbatim where provided.\n- Use the exact prop names, types, and `importPath` values returned by `get_component_docs`.\n- Do **not** invent @corva/ui primitives, props, icons, or tokens that the MCP tools did not surface.\n- Prefer semantic HTML first (`<button>`, `<nav>`, `<main>`, etc.); add ARIA only where native semantics are\n insufficient, and do not strip roles or semantics that `@corva/ui` primitives already provide.\n- When modifying an existing page/component, preserve existing data flow, state, and non-visual behavior unless the\n user explicitly asked to change them. Touch the UI layer only.\n- When a style value must vary per instance from data (per-row colors, per-segment widths, etc.), pass it via a CSS\n custom property rather than writing inline `style={{ <styling-property>: value }}`. Pattern:\n `<div style={{ '--phase-color': c, '--phase-flex': flex } as React.CSSProperties} />` paired with\n `background: var(--phase-color)` in the SCSS module. If the target repo uses a different style system, follow that\n system's typed dynamic-value mechanism instead.\n- Per-instance dynamic styling applies only to genuinely runtime values (user input, API data, layout measurement). A\n finite design palette of phase / status / category colors is NOT a runtime value — map those to `get_theme_docs`\n tokens or to a documented `@corva/ui` color export. If no token exists, surface them as Unmapped tokens in Step 10\n rather than committing raw hex anywhere (mock data, SCSS extension files, JS constants).\n\nBefore concluding, run this pre-delivery self-check:\n\n- Every `@corva/ui` import statement came from `get_component_docs` output — none guessed.\n- Every icon export name matches what `search_corva_ui` returned — no invented suffixes.\n- No hard-coded hex, rgba, or raw px spacing that should resolve through `get_theme_docs` tokens.\n- Every prop name **and value** matches the schema from `get_component_docs`, not a Figma variant label.\n- For every third-party rendering / runtime library I imported (chart, map, code editor, virtualization, etc.), I ran\n capability-based `@corva/ui` searches across all three axes (widget shell, interaction controls, setup / config\n utility) AND across both `category: 'v2'` and `category: 'v1'`, and either used the Corva shell with its companion\n control family or listed the import in Implementation deviations together with the exact capability queries I ran for\n each version.\n- The final section of this response is `## Gap Report` with the four required subsections (Step 10).\n\n## Step 10 — Gap Report (final section of your response)\n\nYour final assistant response must end with a top-level `## Gap Report` section using the exact shape below. When a\nsubsection has nothing to report, write `_None._` — do not omit subsections.\n\n ## Gap Report\n\n ### Unmapped design nodes\n - <node name / Figma id> — <why no @corva/ui primitive fit; suggested action>\n - …or `_None._`\n\n ### Unmapped tokens\n - <token role e.g. \"axis label color\"> — <Figma value> — <closest @corva/ui token, or \"no equivalent\">\n - …or `_None._`\n\n ### Implementation deviations\n - <departure from convention or design> — <reason> — <follow-up needed>\n - e.g. raw chart-config literals, custom HTML where a primitive existed, third-party rendering lib (chart, map,\n editor) imported directly after capability-based `@corva/ui` searches found no Corva shell — list the queries\n attempted across both `category: 'v2'` and `category: 'v1'`, deferred a11y, etc.\n - …or `_None._`\n\n ### Ambiguous props or interactions\n - <component / interaction> — <ambiguity> — <assumption made or question for the user>\n - …or `_None._`\n\nBegin with Step 1 now.\n";
98349
+
98350
+ const figmaToCodePromptName = 'figma_to_code';
98351
+ const figmaToCodePromptTitle = 'Figma to Code';
98352
+ const figmaToCodePromptDescription = `Translate a Figma node into React components that follow @corva/ui conventions.
98353
+ Orchestrates the Figma MCP (for design context) and the corva-ui MCP (for components, icons, theme, hooks).
98354
+
98355
+ Argument:
98356
+ - input: Full user request. Paste the Figma URL (design or branch) together with any extra context — target path / file to extend / naming / edge cases. The assistant extracts the URL itself.
98357
+
98358
+ Why a single argument: Claude Code's MCP-prompt bridge splits positional string args by whitespace, so a multi-arg schema would swallow only the first token per arg. One freeform arg captures the whole request.
98359
+
98360
+ Prerequisite: the Figma Dev Mode MCP must be enabled in the client (https://www.figma.com/design/).`;
98361
+ const figmaToCodePromptArgsSchema = {
98362
+ input: z
98363
+ .string()
98364
+ .optional()
98365
+ .describe('Full user request. Include the Figma URL and any target path / extra context. If omitted, the assistant will ask the user before generating.'),
98366
+ };
98367
+ const INPUT_FALLBACK = '(no input provided — ask the user for the Figma URL and target path/directory before generating)';
98368
+ const handleFigmaToCode = (args) => {
98369
+ const text = figmaToCodePromptTemplate.replace('{{input}}', args.input ?? INPUT_FALLBACK);
98370
+ return {
98371
+ description: figmaToCodePromptDescription,
98372
+ messages: [
98373
+ {
98374
+ role: 'user',
98375
+ content: { type: 'text', text },
98376
+ },
98377
+ ],
98378
+ };
98379
+ };
98380
+
95988
98381
  const readJsonField = (filePath, ...keys) => {
95989
98382
  try {
95990
98383
  let value = JSON.parse(readFileSync(filePath, 'utf-8'));
@@ -96076,6 +98469,7 @@ class CorvaUiMcpServer {
96076
98469
  version: MCP_SERVER_VERSION,
96077
98470
  });
96078
98471
  this.setupTools();
98472
+ this.setupPrompts();
96079
98473
  this.setupErrorHandling();
96080
98474
  this.setupInitializedHandler();
96081
98475
  this.mcpLogger.timeEnd('startup', startupTimer);
@@ -96204,6 +98598,77 @@ class CorvaUiMcpServer {
96204
98598
  throw error;
96205
98599
  }
96206
98600
  }
98601
+ executePromptWithObservability(promptName, args, handler, options) {
98602
+ this.requestCount += 1;
98603
+ const startTime = Date.now();
98604
+ const timer = this.mcpLogger.time(promptName);
98605
+ const serializedArgs = serializeToolParams(args);
98606
+ const parentContext = options?.parentContext;
98607
+ const requestId = options?.requestId;
98608
+ try {
98609
+ const result = handler();
98610
+ const endTime = Date.now();
98611
+ const ms = timer.stop();
98612
+ const serialized = serializePromptResult(result);
98613
+ const summary = `${serialized.messageCount} msg / ${serialized.sizeBytes}B`;
98614
+ this.mcpLogger.request(promptName, serializedArgs, summary, ms);
98615
+ if (this.telemetry.isEnabled()) {
98616
+ const clientInfo = this.server.server.getClientVersion();
98617
+ this.telemetry.recordPromptCall({
98618
+ promptName,
98619
+ args: serializedArgs,
98620
+ resultSizeBytes: serialized.sizeBytes,
98621
+ messageCount: serialized.messageCount,
98622
+ startTime,
98623
+ endTime,
98624
+ clientName: clientInfo?.name,
98625
+ clientVersion: clientInfo?.version,
98626
+ sessionId: this.telemetry.sessionId,
98627
+ protocolVersion: MCP_PROTOCOL_VERSION,
98628
+ networkTransport: MCP_NETWORK_TRANSPORT,
98629
+ parentContext,
98630
+ requestId,
98631
+ extraAttrs: getProjectIdentityAttrs(this.projectIdentity),
98632
+ });
98633
+ this.telemetry.metrics.recordPromptInvocation(promptName, ms);
98634
+ }
98635
+ return result;
98636
+ }
98637
+ catch (error) {
98638
+ const endTime = Date.now();
98639
+ const ms = timer.stop();
98640
+ this.mcpLogger.request(promptName, serializedArgs, 'error', ms);
98641
+ if (this.telemetry.isEnabled()) {
98642
+ const serializedError = serializeToolError(error);
98643
+ const clientInfo = this.server.server.getClientVersion();
98644
+ this.telemetry.recordPromptCall({
98645
+ promptName,
98646
+ args: serializedArgs,
98647
+ resultSizeBytes: 0,
98648
+ messageCount: 0,
98649
+ startTime,
98650
+ endTime,
98651
+ isError: true,
98652
+ error: serializedError.error,
98653
+ errorType: serializedError.errorType,
98654
+ clientName: clientInfo?.name,
98655
+ clientVersion: clientInfo?.version,
98656
+ sessionId: this.telemetry.sessionId,
98657
+ protocolVersion: MCP_PROTOCOL_VERSION,
98658
+ networkTransport: MCP_NETWORK_TRANSPORT,
98659
+ parentContext,
98660
+ requestId,
98661
+ extraAttrs: {
98662
+ ...serializedError.extraAttrs,
98663
+ ...getProjectIdentityAttrs(this.projectIdentity),
98664
+ },
98665
+ });
98666
+ this.telemetry.metrics.recordPromptInvocation(promptName, ms);
98667
+ this.telemetry.metrics.recordPromptError(promptName, serializedError.errorType);
98668
+ }
98669
+ throw error;
98670
+ }
98671
+ }
96207
98672
  setupTools() {
96208
98673
  this.server.registerTool(searchToolName, {
96209
98674
  title: searchToolTitle,
@@ -96343,6 +98808,16 @@ class CorvaUiMcpServer {
96343
98808
  }
96344
98809
  });
96345
98810
  }
98811
+ setupPrompts() {
98812
+ this.server.registerPrompt(figmaToCodePromptName, {
98813
+ title: figmaToCodePromptTitle,
98814
+ description: figmaToCodePromptDescription,
98815
+ argsSchema: figmaToCodePromptArgsSchema,
98816
+ }, (args, extra) => {
98817
+ const parentContext = extractContextFromMeta(extra?._meta);
98818
+ return this.executePromptWithObservability(figmaToCodePromptName, args, () => handleFigmaToCode(args), { parentContext, requestId: extra?.requestId });
98819
+ });
98820
+ }
96346
98821
  async run() {
96347
98822
  const connectTimer = this.mcpLogger.time('transport-connect');
96348
98823
  this.transport = new StdioServerTransport();