@corva/ui 3.58.0-1 → 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-1";
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 = {
@@ -8698,311 +8777,1679 @@ var componentsV1Data = [
8698
8777
  description: ""
8699
8778
  },
8700
8779
  {
8701
- name: "disableCloseOnSelect",
8702
- type: "boolean",
8703
- required: false,
8704
- description: "If `true` - prevents Autocomplete from closing on select"
8780
+ name: "disableCloseOnSelect",
8781
+ type: "boolean",
8782
+ required: false,
8783
+ description: "If `true` - prevents Autocomplete from closing on select"
8784
+ },
8785
+ {
8786
+ name: "multiple",
8787
+ type: "boolean",
8788
+ required: false,
8789
+ description: ""
8790
+ }
8791
+ ],
8792
+ examples: [
8793
+ {
8794
+ name: "Default",
8795
+ description: "",
8796
+ code: "{\n const [value, setValue] = useState<Option>();\n return (\n <Autocomplete\n {...props}\n value={value}\n onChange={(e, newValue, ...rest) => {\n setValue(newValue as Option);\n props.onChange?.(e, newValue, ...rest);\n }}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n );\n}"
8797
+ },
8798
+ {
8799
+ name: "InputOptions",
8800
+ description: "Input-related options should be done through `renderInput` prop",
8801
+ code: "{\n return (\n <Autocomplete\n value={null}\n options={Options}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n renderInput={params => (\n <TextField {...params} label=\"Field Label\" placeholder=\"Field placeholder\" />\n )}\n />\n );\n}"
8802
+ },
8803
+ {
8804
+ name: "Sizes",
8805
+ description: "Input size can be controlled through `size` prop.",
8806
+ code: "{\n return (\n <SbRow>\n <Autocomplete\n value={Options[1]}\n size=\"small\"\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n <Autocomplete\n value={Options[1]}\n size=\"medium\"\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n </SbRow>\n );\n}"
8807
+ },
8808
+ {
8809
+ name: "LoadingState",
8810
+ description: "Use `loading` and `loadingText` props to show a custom message when some data is being loaded in the background",
8811
+ code: "{\n return (\n <Autocomplete\n value={null}\n options={[]}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n loading\n loadingText={\n <>\n Can't you see, I'm <u>loading</u>!\n </>\n }\n />\n );\n}"
8812
+ },
8813
+ {
8814
+ name: "DisabledOptions",
8815
+ description: "Use `getOptionDisabled` prop to tell which options are disabled",
8816
+ code: "{\n return (\n <Autocomplete\n value={null}\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n getOptionDisabled={(option) => (option as Option).id === '2'}\n />\n );\n}"
8817
+ },
8818
+ {
8819
+ name: "Creatable",
8820
+ description: "Works only with string `options`",
8821
+ code: "{\n const [options, setOptions] = useState(Options.map((option: Option) => option.name));\n const [value, setValue] = useState<string>();\n\n return (\n <Autocomplete\n options={options}\n renderInput={params => <TextField {...params} />}\n value={value}\n isCreatable\n getOptionLabel={i => i as string}\n onChange={(value: any, wasCreated) => {\n console.log('onChange', value, wasCreated);\n\n if (wasCreated) {\n setOptions(prev => [...prev, value as string]);\n }\n\n setValue(value);\n }}\n />\n );\n}"
8822
+ }
8823
+ ],
8824
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Autocomplete/Autocomplete.tsx",
8825
+ figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=9573%3A7954&mode=dev",
8826
+ keywords: [
8827
+ "autocomplete",
8828
+ "search",
8829
+ "typeahead",
8830
+ "suggest",
8831
+ "filter",
8832
+ "wrapper",
8833
+ "over",
8834
+ "mui's",
8835
+ "`<autocomplete/>`",
8836
+ "component",
8837
+ "selecting",
8838
+ "values",
8839
+ "predefined",
8840
+ "list,",
8841
+ "ability"
8842
+ ]
8843
+ },
8844
+ {
8845
+ name: "Avatar",
8846
+ modulePath: "components/Avatar",
8847
+ importPath: "@corva/ui/components",
8848
+ category: "v1",
8849
+ description: "Used to display user's avatar or initials",
8850
+ isExperimental: false,
8851
+ isDeprecated: false,
8852
+ props: [
8853
+ ],
8854
+ examples: [
8855
+ {
8856
+ name: "Default",
8857
+ description: "",
8858
+ code: "<Avatar {...props} />"
8859
+ },
8860
+ {
8861
+ name: "TextSize",
8862
+ description: "Text size is calculated by the following formula: `Math.floor(avatarSize / 2)`\n\nHowever, there are \"fixed\" avatar sizes: `24`, `32`, `40`, `48`, `128`, and `200`, for which their own font sizes are defined",
8863
+ code: "{\n const sizes = [12, 24, 28, 32, 36, 40, 48, 100, 128, 180, 200];\n return (\n <SbColumn>\n {sizes.map(size => (\n <SbRow key={size} alignItems=\"center\">\n {size}px\n <Avatar size={size} displayName=\"Ian Moone\" />\n </SbRow>\n ))}\n </SbColumn>\n );\n}"
8864
+ }
8865
+ ],
8866
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Avatar/index.tsx",
8867
+ figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=19105%3A59473",
8868
+ keywords: [
8869
+ "avatar",
8870
+ "user",
8871
+ "profile",
8872
+ "image",
8873
+ "icon",
8874
+ "used",
8875
+ "display",
8876
+ "user's",
8877
+ "initials"
8878
+ ]
8879
+ },
8880
+ {
8881
+ name: "BICOffsetPickerDialog",
8882
+ modulePath: "components/BICOffsetPickerDialog",
8883
+ importPath: "@corva/ui/components",
8884
+ category: "v1",
8885
+ description: "",
8886
+ isExperimental: false,
8887
+ isDeprecated: false,
8888
+ props: [
8889
+ {
8890
+ name: "defaultSubjectWell",
8891
+ type: "object",
8892
+ required: false,
8893
+ description: ""
8894
+ },
8895
+ {
8896
+ name: "offsetSetting",
8897
+ type: "object",
8898
+ required: false,
8899
+ description: ""
8900
+ },
8901
+ {
8902
+ name: "subjectWellId",
8903
+ type: "number",
8904
+ required: false,
8905
+ description: ""
8906
+ },
8907
+ {
8908
+ name: "companyId",
8909
+ type: "number",
8910
+ required: false,
8911
+ description: ""
8912
+ },
8913
+ {
8914
+ name: "currentUser",
8915
+ type: "object",
8916
+ required: false,
8917
+ description: ""
8918
+ },
8919
+ {
8920
+ name: "isOpen",
8921
+ type: "boolean",
8922
+ required: true,
8923
+ description: ""
8924
+ },
8925
+ {
8926
+ name: "onClose",
8927
+ type: "function",
8928
+ required: true,
8929
+ description: ""
8930
+ },
8931
+ {
8932
+ name: "onSave",
8933
+ type: "function",
8934
+ required: true,
8935
+ description: ""
8936
+ },
8937
+ {
8938
+ name: "addWellsUsabilityInfo",
8939
+ type: "function",
8940
+ required: false,
8941
+ description: ""
8942
+ },
8943
+ {
8944
+ name: "unusableWellAlarm",
8945
+ type: "string",
8946
+ required: false,
8947
+ description: ""
8948
+ }
8949
+ ],
8950
+ examples: [
8951
+ ],
8952
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/BICOffsetPickerDialog/BICOffsetPickerDialog.tsx",
8953
+ keywords: [
8954
+ "bicoffsetpickerdialog"
8955
+ ]
8956
+ },
8957
+ {
8958
+ name: "Breadcrumbs",
8959
+ modulePath: "components/Breadcrumbs",
8960
+ importPath: "@corva/ui/components",
8961
+ category: "v1",
8962
+ description: "Used as a hierarchical navigation element at the tp of the page",
8963
+ isExperimental: false,
8964
+ isDeprecated: false,
8965
+ props: [
8966
+ {
8967
+ name: "pathItems",
8968
+ type: "{ text: string; href?: string }[]",
8969
+ required: true,
8970
+ description: ""
8971
+ },
8972
+ {
8973
+ name: "classes",
8974
+ type: "Record<string, string>",
8975
+ required: false,
8976
+ description: ""
8977
+ },
8978
+ {
8979
+ name: "withBackIcon",
8980
+ type: "boolean",
8981
+ required: false,
8982
+ description: ""
8983
+ },
8984
+ {
8985
+ name: "separator",
8986
+ type: "ReactNode",
8987
+ required: false,
8988
+ description: ""
8989
+ }
8990
+ ],
8991
+ examples: [
8992
+ {
8993
+ name: "Default",
8994
+ description: "",
8995
+ code: "<Breadcrumbs {...props} />"
8996
+ }
8997
+ ],
8998
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Breadcrumbs/index.tsx",
8999
+ figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=31967%3A122781&mode=dev",
9000
+ keywords: [
9001
+ "breadcrumbs",
9002
+ "navigation",
9003
+ "path",
9004
+ "trail",
9005
+ "breadcrumb",
9006
+ "used",
9007
+ "hierarchical",
9008
+ "element",
9009
+ "page"
9010
+ ]
9011
+ },
9012
+ {
9013
+ name: "Button",
9014
+ modulePath: "components/Button",
9015
+ importPath: "@corva/ui/components",
9016
+ category: "v1",
9017
+ description: "A wrapper around Material UI v4 `Button`. Read more information on the [MUI docs page](https://v4.mui.com/components/buttons/#button)",
9018
+ isExperimental: false,
9019
+ isDeprecated: false,
9020
+ props: [
9021
+ ],
9022
+ examples: [
9023
+ {
9024
+ name: "Playground",
9025
+ description: "Use to highlight the most important actions in any experience.",
9026
+ code: "<Button {...props}>Click me!</Button>"
9027
+ },
9028
+ {
9029
+ name: "Size",
9030
+ description: "Adjust the component size using the `size` prop. It supports 3 sizes:\n\n- `large`: use for large, very important buttons\n- `medium` (default): should be used in most cases\n- `small`: use when space is at a premium",
9031
+ code: "<SbColumn>\n <Button size=\"large\">Click me!</Button>\n <Button size=\"medium\">Click me!</Button>\n <Button size=\"small\">Click me!</Button>\n </SbColumn>"
9032
+ },
9033
+ {
9034
+ name: "Color",
9035
+ description: "We use 2 color variants, controlled through `color` prop:\n\n- `default`\n- `primary`",
9036
+ code: "<SbColumn>\n <Button color=\"default\">Click me!</Button>\n <Button color=\"primary\">Click me!</Button>\n </SbColumn>"
9037
+ },
9038
+ {
9039
+ name: "Variant",
9040
+ description: "Background is controlled through `variant` prop:\n\n- `contained`\n- `text`\n\nNotice the interaction with `color` prop",
9041
+ code: "<SbRow>\n <SbColumn>\n <Button variant=\"contained\">Click me!</Button>\n <Button variant=\"text\">Click me!</Button>\n </SbColumn>\n <SbColumn>\n <Button variant=\"contained\" color=\"primary\">\n Click me!\n </Button>\n <Button variant=\"text\" color=\"primary\">\n Click me!\n </Button>\n </SbColumn>\n </SbRow>"
9042
+ },
9043
+ {
9044
+ name: "Icons",
9045
+ description: "Pass leading and/or trailing icons through `startIcon` and `endIcon` props respectively. The icon's size is adjusted automatically.\n\nSome text goes here",
9046
+ code: "<SbRow>\n <SbColumn>\n <Button startIcon={<BubbleChartIcon />} size=\"large\">\n Click me!\n </Button>\n <Button startIcon={<BubbleChartIcon />} size=\"medium\">\n Click me!\n </Button>\n <Button startIcon={<BubbleChartIcon />} size=\"small\">\n Click me!\n </Button>\n </SbColumn>\n <SbColumn>\n <Button endIcon={<BubbleChartIcon />} size=\"large\">\n Click me!\n </Button>\n <Button endIcon={<BubbleChartIcon />} size=\"medium\">\n Click me!\n </Button>\n <Button endIcon={<BubbleChartIcon />} size=\"small\">\n Click me!\n </Button>\n </SbColumn>\n </SbRow>"
9047
+ }
9048
+ ],
9049
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Button/index.ts",
9050
+ figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=19105%3A59490",
9051
+ keywords: [
9052
+ "button",
9053
+ "action",
9054
+ "click",
9055
+ "submit",
9056
+ "trigger",
9057
+ "cta",
9058
+ "wrapper",
9059
+ "around",
9060
+ "material",
9061
+ "`button`.",
9062
+ "read",
9063
+ "more",
9064
+ "information",
9065
+ "[mui",
9066
+ "docs",
9067
+ "page](https://v4.mui.com/components/buttons/#button)"
9068
+ ]
9069
+ },
9070
+ {
9071
+ name: "Casing",
9072
+ modulePath: "components/Casing",
9073
+ importPath: "@corva/ui/components",
9074
+ category: "v1",
9075
+ description: "",
9076
+ isExperimental: false,
9077
+ isDeprecated: false,
9078
+ props: [
9079
+ ],
9080
+ examples: [
9081
+ ],
9082
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Casing/Casing.tsx",
9083
+ keywords: [
9084
+ "casing"
9085
+ ]
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}"
8705
10181
  },
8706
10182
  {
8707
- name: "multiple",
8708
- type: "boolean",
8709
- required: false,
8710
- description: ""
8711
- }
8712
- ],
8713
- examples: [
8714
- {
8715
- name: "Default",
10183
+ name: "AxisDropdownChart",
8716
10184
  description: "",
8717
- code: "{\n const [value, setValue] = useState<Option>();\n return (\n <Autocomplete\n {...props}\n value={value}\n onChange={(e, newValue, ...rest) => {\n setValue(newValue as Option);\n props.onChange?.(e, newValue, ...rest);\n }}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n );\n}"
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)"
8718
10186
  },
8719
10187
  {
8720
- name: "InputOptions",
8721
- description: "Input-related options should be done through `renderInput` prop",
8722
- code: "{\n return (\n <Autocomplete\n value={null}\n options={Options}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n renderInput={params => (\n <TextField {...params} label=\"Field Label\" placeholder=\"Field placeholder\" />\n )}\n />\n );\n}"
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}"
8723
10191
  },
8724
10192
  {
8725
- name: "Sizes",
8726
- description: "Input size can be controlled through `size` prop.",
8727
- code: "{\n return (\n <SbRow>\n <Autocomplete\n value={Options[1]}\n size=\"small\"\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n <Autocomplete\n value={Options[1]}\n size=\"medium\"\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n />\n </SbRow>\n );\n}"
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)"
8728
10196
  },
8729
10197
  {
8730
- name: "LoadingState",
8731
- description: "Use `loading` and `loadingText` props to show a custom message when some data is being loaded in the background",
8732
- code: "{\n return (\n <Autocomplete\n value={null}\n options={[]}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n loading\n loadingText={\n <>\n Can't you see, I'm <u>loading</u>!\n </>\n }\n />\n );\n}"
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)"
8733
10201
  },
8734
10202
  {
8735
- name: "DisabledOptions",
8736
- description: "Use `getOptionDisabled` prop to tell which options are disabled",
8737
- code: "{\n return (\n <Autocomplete\n value={null}\n options={Options}\n renderInput={params => <TextField {...params} />}\n getOptionLabel={(option) => (option as Option).name}\n renderOption={(option) => (option as Option).name}\n getOptionDisabled={(option) => (option as Option).id === '2'}\n />\n );\n}"
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)"
8738
10206
  },
8739
10207
  {
8740
- name: "Creatable",
8741
- description: "Works only with string `options`",
8742
- code: "{\n const [options, setOptions] = useState(Options.map((option: Option) => option.name));\n const [value, setValue] = useState<string>();\n\n return (\n <Autocomplete\n options={options}\n renderInput={params => <TextField {...params} />}\n value={value}\n isCreatable\n getOptionLabel={i => i as string}\n onChange={(value: any, wasCreated) => {\n console.log('onChange', value, wasCreated);\n\n if (wasCreated) {\n setOptions(prev => [...prev, value as string]);\n }\n\n setValue(value);\n }}\n />\n );\n}"
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}"
8743
10211
  }
8744
10212
  ],
8745
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Autocomplete/Autocomplete.tsx",
8746
- figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=9573%3A7954&mode=dev",
10213
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ResetZoomButton.js",
8747
10214
  keywords: [
8748
- "autocomplete",
8749
- "search",
8750
- "typeahead",
8751
- "suggest",
8752
- "filter",
8753
- "wrapper",
8754
- "over",
8755
- "mui's",
8756
- "`<autocomplete/>`",
8757
- "component",
8758
- "selecting",
8759
- "values",
8760
- "predefined",
8761
- "list,",
8762
- "ability"
10215
+ "resetzoombutton",
10216
+ "reset",
10217
+ "zoom",
10218
+ "button",
10219
+ "chart",
10220
+ "family.",
10221
+ "story",
10222
+ "canonical",
10223
+ "usage."
8763
10224
  ]
8764
10225
  },
8765
10226
  {
8766
- name: "Avatar",
8767
- modulePath: "components/Avatar",
10227
+ name: "HideAxesButton",
10228
+ modulePath: "components/Chart/components/buttons/HideAxesButton",
8768
10229
  importPath: "@corva/ui/components",
8769
10230
  category: "v1",
8770
- description: "Used to display user's avatar or initials",
10231
+ description: "HideAxesButton hide axes button for the Chart family. See the Chart story for canonical usage.",
8771
10232
  isExperimental: false,
8772
10233
  isDeprecated: false,
8773
10234
  props: [
8774
10235
  ],
8775
10236
  examples: [
8776
10237
  {
8777
- name: "Default",
10238
+ name: "Chart",
8778
10239
  description: "",
8779
- code: "<Avatar {...props} />"
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}"
8780
10241
  },
8781
10242
  {
8782
- name: "TextSize",
8783
- description: "Text size is calculated by the following formula: `Math.floor(avatarSize / 2)`\n\nHowever, there are \"fixed\" avatar sizes: `24`, `32`, `40`, `48`, `128`, and `200`, for which their own font sizes are defined",
8784
- code: "{\n const sizes = [12, 24, 28, 32, 36, 40, 48, 100, 128, 180, 200];\n return (\n <SbColumn>\n {sizes.map(size => (\n <SbRow key={size} alignItems=\"center\">\n {size}px\n <Avatar size={size} displayName=\"Ian Moone\" />\n </SbRow>\n ))}\n </SbColumn>\n );\n}"
8785
- }
8786
- ],
8787
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Avatar/index.tsx",
8788
- figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=19105%3A59473",
8789
- keywords: [
8790
- "avatar",
8791
- "user",
8792
- "profile",
8793
- "image",
8794
- "icon",
8795
- "used",
8796
- "display",
8797
- "user's",
8798
- "initials"
8799
- ]
8800
- },
8801
- {
8802
- name: "BICOffsetPickerDialog",
8803
- modulePath: "components/BICOffsetPickerDialog",
8804
- importPath: "@corva/ui/components",
8805
- category: "v1",
8806
- description: "",
8807
- isExperimental: false,
8808
- isDeprecated: false,
8809
- props: [
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
+ },
8810
10247
  {
8811
- name: "defaultSubjectWell",
8812
- type: "object",
8813
- required: false,
8814
- description: ""
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)"
8815
10251
  },
8816
10252
  {
8817
- name: "offsetSetting",
8818
- type: "object",
8819
- required: false,
8820
- description: ""
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)"
8821
10256
  },
8822
10257
  {
8823
- name: "subjectWellId",
8824
- type: "number",
8825
- required: false,
8826
- description: ""
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)"
8827
10261
  },
8828
10262
  {
8829
- name: "companyId",
8830
- type: "number",
8831
- required: false,
8832
- description: ""
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)"
8833
10266
  },
8834
10267
  {
8835
- name: "currentUser",
8836
- type: "object",
8837
- required: false,
8838
- description: ""
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)"
8839
10271
  },
8840
10272
  {
8841
- name: "isOpen",
8842
- type: "boolean",
8843
- required: true,
8844
- description: ""
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)"
8845
10276
  },
8846
10277
  {
8847
- name: "onClose",
8848
- type: "function",
8849
- required: true,
8850
- description: ""
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)"
8851
10281
  },
8852
10282
  {
8853
- name: "onSave",
8854
- type: "function",
8855
- required: true,
8856
- description: ""
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)"
8857
10286
  },
8858
10287
  {
8859
- name: "addWellsUsabilityInfo",
8860
- type: "function",
8861
- required: false,
8862
- description: ""
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)"
8863
10291
  },
8864
10292
  {
8865
- name: "unusableWellAlarm",
8866
- type: "string",
8867
- required: false,
8868
- description: ""
8869
- }
8870
- ],
8871
- examples: [
8872
- ],
8873
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/BICOffsetPickerDialog/BICOffsetPickerDialog.tsx",
8874
- keywords: [
8875
- "bicoffsetpickerdialog"
8876
- ]
8877
- },
8878
- {
8879
- name: "Breadcrumbs",
8880
- modulePath: "components/Breadcrumbs",
8881
- importPath: "@corva/ui/components",
8882
- category: "v1",
8883
- description: "Used as a hierarchical navigation element at the tp of the page",
8884
- isExperimental: false,
8885
- isDeprecated: false,
8886
- props: [
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
+ },
8887
10297
  {
8888
- name: "pathItems",
8889
- type: "{ text: string; href?: string }[]",
8890
- required: true,
8891
- description: ""
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)"
8892
10301
  },
8893
10302
  {
8894
- name: "classes",
8895
- type: "Record<string, string>",
8896
- required: false,
8897
- description: ""
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}"
8898
10306
  },
8899
10307
  {
8900
- name: "withBackIcon",
8901
- type: "boolean",
8902
- required: false,
8903
- description: ""
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)"
8904
10311
  },
8905
10312
  {
8906
- name: "separator",
8907
- type: "ReactNode",
8908
- required: false,
8909
- description: ""
8910
- }
8911
- ],
8912
- examples: [
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
+ },
8913
10317
  {
8914
- name: "Default",
10318
+ name: "HighchartStockChart",
8915
10319
  description: "",
8916
- code: "<Breadcrumbs {...props} />"
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}"
8917
10326
  }
8918
10327
  ],
8919
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Breadcrumbs/index.tsx",
8920
- figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=31967%3A122781&mode=dev",
10328
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/HideAxesButton.js",
8921
10329
  keywords: [
8922
- "breadcrumbs",
8923
- "navigation",
8924
- "path",
8925
- "trail",
8926
- "breadcrumb",
8927
- "used",
8928
- "hierarchical",
8929
- "element",
8930
- "page"
10330
+ "hideaxesbutton",
10331
+ "hide",
10332
+ "axes",
10333
+ "button",
10334
+ "chart",
10335
+ "family.",
10336
+ "story",
10337
+ "canonical",
10338
+ "usage."
8931
10339
  ]
8932
10340
  },
8933
10341
  {
8934
- name: "Button",
8935
- modulePath: "components/Button",
10342
+ name: "ChartTypeButton",
10343
+ modulePath: "components/Chart/components/buttons/ChartTypeButton",
8936
10344
  importPath: "@corva/ui/components",
8937
10345
  category: "v1",
8938
- description: "A wrapper around Material UI v4 `Button`. Read more information on the [MUI docs page](https://v4.mui.com/components/buttons/#button)",
10346
+ description: "ChartTypeButton chart type button for the Chart family. See the Chart story for canonical usage.",
8939
10347
  isExperimental: false,
8940
10348
  isDeprecated: false,
8941
10349
  props: [
8942
10350
  ],
8943
10351
  examples: [
8944
10352
  {
8945
- name: "Playground",
8946
- description: "Use to highlight the most important actions in any experience.",
8947
- code: "<Button {...props}>Click me!</Button>"
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}"
8948
10356
  },
8949
10357
  {
8950
- name: "Size",
8951
- description: "Adjust the component size using the `size` prop. It supports 3 sizes:\n\n- `large`: use for large, very important buttons\n- `medium` (default): should be used in most cases\n- `small`: use when space is at a premium",
8952
- code: "<SbColumn>\n <Button size=\"large\">Click me!</Button>\n <Button size=\"medium\">Click me!</Button>\n <Button size=\"small\">Click me!</Button>\n </SbColumn>"
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}"
8953
10361
  },
8954
10362
  {
8955
- name: "Color",
8956
- description: "We use 2 color variants, controlled through `color` prop:\n\n- `default`\n- `primary`",
8957
- code: "<SbColumn>\n <Button color=\"default\">Click me!</Button>\n <Button color=\"primary\">Click me!</Button>\n </SbColumn>"
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)"
8958
10366
  },
8959
10367
  {
8960
- name: "Variant",
8961
- description: "Background is controlled through `variant` prop:\n\n- `contained`\n- `text`\n\nNotice the interaction with `color` prop",
8962
- code: "<SbRow>\n <SbColumn>\n <Button variant=\"contained\">Click me!</Button>\n <Button variant=\"text\">Click me!</Button>\n </SbColumn>\n <SbColumn>\n <Button variant=\"contained\" color=\"primary\">\n Click me!\n </Button>\n <Button variant=\"text\" color=\"primary\">\n Click me!\n </Button>\n </SbColumn>\n </SbRow>"
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)"
8963
10371
  },
8964
10372
  {
8965
- name: "Icons",
8966
- description: "Pass leading and/or trailing icons through `startIcon` and `endIcon` props respectively. The icon's size is adjusted automatically.\n\nSome text goes here",
8967
- code: "<SbRow>\n <SbColumn>\n <Button startIcon={<BubbleChartIcon />} size=\"large\">\n Click me!\n </Button>\n <Button startIcon={<BubbleChartIcon />} size=\"medium\">\n Click me!\n </Button>\n <Button startIcon={<BubbleChartIcon />} size=\"small\">\n Click me!\n </Button>\n </SbColumn>\n <SbColumn>\n <Button endIcon={<BubbleChartIcon />} size=\"large\">\n Click me!\n </Button>\n <Button endIcon={<BubbleChartIcon />} size=\"medium\">\n Click me!\n </Button>\n <Button endIcon={<BubbleChartIcon />} size=\"small\">\n Click me!\n </Button>\n </SbColumn>\n </SbRow>"
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}"
8968
10441
  }
8969
10442
  ],
8970
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Button/index.ts",
8971
- figmaUrl: "https://www.figma.com/file/PUgBxjNswqqG1yyU6OQERZ/Corva-Design-System?node-id=19105%3A59490",
10443
+ sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Chart/components/buttons/ChartTypeButton.js",
8972
10444
  keywords: [
10445
+ "charttypebutton",
10446
+ "chart",
10447
+ "type",
8973
10448
  "button",
8974
- "action",
8975
- "click",
8976
- "submit",
8977
- "trigger",
8978
- "cta",
8979
- "wrapper",
8980
- "around",
8981
- "material",
8982
- "`button`.",
8983
- "read",
8984
- "more",
8985
- "information",
8986
- "[mui",
8987
- "docs",
8988
- "page](https://v4.mui.com/components/buttons/#button)"
8989
- ]
8990
- },
8991
- {
8992
- name: "Casing",
8993
- modulePath: "components/Casing",
8994
- importPath: "@corva/ui/components",
8995
- category: "v1",
8996
- description: "",
8997
- isExperimental: false,
8998
- isDeprecated: false,
8999
- props: [
9000
- ],
9001
- examples: [
9002
- ],
9003
- sourceUrl: "https://github.com/corva-ai/corva-ui/blob/develop/src/components/Casing/Casing.tsx",
9004
- keywords: [
9005
- "casing"
10449
+ "family.",
10450
+ "story",
10451
+ "canonical",
10452
+ "usage."
9006
10453
  ]
9007
10454
  },
9008
10455
  {
@@ -83569,6 +85016,270 @@ var entries = [
83569
85016
  importPath: "@corva/ui/components",
83570
85017
  searchText: "casing casing"
83571
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
+ },
83572
85283
  {
83573
85284
  id: "component-v1-ChartActionsList",
83574
85285
  type: "component",
@@ -93706,6 +95417,18 @@ var byCategory = {
93706
95417
  "component-v1-Breadcrumbs",
93707
95418
  "component-v1-Button",
93708
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",
93709
95432
  "component-v1-ChartActionsList",
93710
95433
  "component-v1-Checkbox",
93711
95434
  "component-v1-Chip",
@@ -95683,7 +97406,9 @@ Examples:
95683
97406
  - "button" - find button components
95684
97407
  - "loading spinner" - find loading indicators
95685
97408
  - "date picker" - find date/time components
95686
- - "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.`;
95687
97412
  const searchToolSchema = {
95688
97413
  query: z.string().describe('Search query - component name, use case, or description'),
95689
97414
  type: z
@@ -95715,18 +97440,16 @@ const handleSearch = (args) => {
95715
97440
  const rawWords = queryLower.trim().split(/\s+/);
95716
97441
  const queryWords = rawWords.filter(w => w.length > 1);
95717
97442
  const isMultiWord = rawWords.length >= 2 && queryWords.length >= 2;
95718
- 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;
95719
97446
  // Filter by type
95720
97447
  let { entries } = searchIndex;
95721
97448
  if (type !== 'all') {
95722
97449
  entries = entries.filter(e => e.type === type);
95723
97450
  }
95724
- // Filter by category for components
95725
- if (category !== 'all') {
95726
- const fullCategory = category.startsWith('components-') ? category : `components-${category}`;
95727
- entries = entries.filter(e => e.type !== 'component' || e.category === fullCategory);
95728
- }
95729
- // 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.
95730
97453
  const { weights, boosts } = SEARCH_CONFIG;
95731
97454
  const scored = entries.map(entry => {
95732
97455
  let score = 0;
@@ -95735,62 +97458,87 @@ const handleSearch = (args) => {
95735
97458
  }
95736
97459
  else {
95737
97460
  // Exact name match (highest priority)
95738
- if (entry.name.toLowerCase() === queryLower) {
97461
+ if (entry.name.toLowerCase() === singleWordQuery) {
95739
97462
  score += weights.exactMatch;
95740
97463
  }
95741
97464
  // Name starts with query
95742
- else if (entry.name.toLowerCase().startsWith(queryLower)) {
97465
+ else if (entry.name.toLowerCase().startsWith(singleWordQuery)) {
95743
97466
  score += weights.startsWith;
95744
97467
  }
95745
97468
  // Name contains query
95746
- else if (entry.name.toLowerCase().includes(queryLower)) {
97469
+ else if (entry.name.toLowerCase().includes(singleWordQuery)) {
95747
97470
  score += weights.contains;
95748
97471
  }
95749
97472
  // Keyword match
95750
97473
  score += entry.keywords.reduce((keywordScore, keyword) => {
95751
- if (keyword === queryLower) {
97474
+ if (keyword === singleWordQuery) {
95752
97475
  return keywordScore + weights.keywordExact;
95753
97476
  }
95754
- if (keyword.includes(queryLower)) {
97477
+ if (keyword.includes(singleWordQuery)) {
95755
97478
  return keywordScore + weights.keywordContains;
95756
97479
  }
95757
97480
  return keywordScore;
95758
97481
  }, 0);
95759
97482
  // Description match
95760
- if (entry.description.toLowerCase().includes(queryLower)) {
97483
+ if (entry.description.toLowerCase().includes(singleWordQuery)) {
95761
97484
  score += weights.description;
95762
97485
  }
95763
97486
  // Full text match
95764
- if (entry.searchText.includes(queryLower)) {
97487
+ if (entry.searchText.includes(singleWordQuery)) {
95765
97488
  score += weights.fullText;
95766
97489
  }
95767
97490
  }
95768
- // Boost V2 components
95769
- 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') {
95770
97495
  score += boosts.v2Component;
95771
97496
  }
95772
97497
  return { entry, score };
95773
97498
  });
95774
- results = scored
97499
+ const ranked = scored
95775
97500
  .filter(s => s.score > 0)
95776
97501
  .sort((a, b) => b.score - a.score)
95777
- .slice(0, limit)
95778
97502
  .map(s => s.entry);
95779
- 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) {
95780
97517
  return {
95781
97518
  response: createToolResponse(`No results found for "${query}". Try:\n- A different search term\n- Using list_corva_ui to see available items`),
95782
97519
  resultCount: 0,
95783
97520
  };
95784
97521
  }
95785
- const formatted = results
95786
- .map(r => {
97522
+ const formatEntry = (r) => {
95787
97523
  const categoryLabel = r.type === 'component' ? ` (${r.category.replace('components-', '')})` : '';
95788
97524
  return `**${r.name}**${categoryLabel} - ${r.type}\n ${r.description || 'No description'}\n Import: \`${r.importPath}\``;
95789
- })
95790
- .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');
95791
97539
  return {
95792
- response: createToolResponse(`Found ${results.length} result(s) for "${query}":\n\n${formatted}`),
95793
- 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,
95794
97542
  };
95795
97543
  };
95796
97544
 
@@ -96595,6 +98343,41 @@ const handleGetDiagnostics = (stats, telemetry, identity) => {
96595
98343
  };
96596
98344
  };
96597
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
+
96598
98381
  const readJsonField = (filePath, ...keys) => {
96599
98382
  try {
96600
98383
  let value = JSON.parse(readFileSync(filePath, 'utf-8'));
@@ -96686,6 +98469,7 @@ class CorvaUiMcpServer {
96686
98469
  version: MCP_SERVER_VERSION,
96687
98470
  });
96688
98471
  this.setupTools();
98472
+ this.setupPrompts();
96689
98473
  this.setupErrorHandling();
96690
98474
  this.setupInitializedHandler();
96691
98475
  this.mcpLogger.timeEnd('startup', startupTimer);
@@ -96814,6 +98598,77 @@ class CorvaUiMcpServer {
96814
98598
  throw error;
96815
98599
  }
96816
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
+ }
96817
98672
  setupTools() {
96818
98673
  this.server.registerTool(searchToolName, {
96819
98674
  title: searchToolTitle,
@@ -96953,6 +98808,16 @@ class CorvaUiMcpServer {
96953
98808
  }
96954
98809
  });
96955
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
+ }
96956
98821
  async run() {
96957
98822
  const connectTimer = this.mcpLogger.time('transport-connect');
96958
98823
  this.transport = new StdioServerTransport();