Skip to content

Commit 3d71dee

Browse files
committed
CUB-873
1 parent dcbcf9b commit 3d71dee

File tree

1 file changed

+123
-3
lines changed

1 file changed

+123
-3
lines changed

docs/pages/product/apis-integrations/chat-api.mdx

Lines changed: 123 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,137 @@ The `cubeSqlApi` tool executes SQL queries and returns data with metadata. The i
537537
- `uuid` (string): Unique identifier for this query result
538538
- `vegaSpec` (string): Vega-Lite v5 visualization specification as JSON string (when visualization is generated)
539539

540-
#### Loading All Results
540+
#### Loading all Results
541541

542542
<WarningBox>
543543
Query results in cubeSqlApi `toolCall.result.data` are limited to **100 rows** by default. Use `totalRows` to check if more data is available.
544544
</WarningBox>
545545

546546
If you need to load all the data, you need to use `sqlQuery` from the results to make a call to the Cube API.
547547

548-
#### Displaying Charts
548+
#### Displaying charts
549549

550-
The cubeSqlApi tool call returns `vegaSpec` that can be used to display data. Please note, it doesn't contain data. You need to use data from `toolCall.result.data`.
550+
The `cubeSqlApi` tool call returns `vegaSpec` that can be used to display data.
551+
552+
Note that it doesn't contain data. You need to use the data from `toolCall.result.data`.
553+
554+
#### Styling charts
555+
556+
When rendering Vega charts, you can apply custom styling to match the look and feel of your application.
557+
This includes adjusting colors, fonts, and other visual elements.
558+
559+
Here's a configuration example that mimics Cube's default styling:
560+
561+
```json
562+
{
563+
// Your Vega configuration
564+
565+
"config": {
566+
"background": "#ffffff",
567+
"padding": 16,
568+
"view": {
569+
"stroke": "transparent"
570+
},
571+
"axis": {
572+
"domainColor": "#E0E0E0",
573+
"gridColor": "#F5F5F5",
574+
"grid": true,
575+
"labelFont": "Inter, sans-serif",
576+
"labelFontSize": 12,
577+
"labelColor": "#43436B",
578+
"titleFont": "Inter, sans-serif",
579+
"titleFontSize": 12,
580+
"titleColor": "#43436B",
581+
"titlePadding": 8
582+
},
583+
"numberFormat": "s",
584+
"timeFormat": "%Y-%m",
585+
"format": {
586+
"number": {
587+
"format": "s",
588+
"formatType": "number"
589+
},
590+
"time": {
591+
"format": "%Y-%m",
592+
"formatType": "time"
593+
}
594+
},
595+
"legend": {
596+
"labelFont": "Inter, sans-serif",
597+
"titleFont": "Inter, sans-serif",
598+
"labelColor": "#43436B",
599+
"titleColor": "#43436B",
600+
"labelFontSize": 12,
601+
"titleFontSize": 12,
602+
"titlePadding": 8,
603+
"padding": 8
604+
},
605+
"line": {
606+
"strokeWidth": 3,
607+
"strokeCap": "round",
608+
"point": true
609+
},
610+
"text": {
611+
"color": "#43436B"
612+
},
613+
"point": {
614+
"filled": true,
615+
"size": 60
616+
},
617+
"range": {
618+
"category": [
619+
"#4E79A7",
620+
"#F28E2B",
621+
"#E15759",
622+
"#76B7B2",
623+
"#59A14F",
624+
"#EDC948",
625+
"#B07AA1",
626+
"#FF9DA7",
627+
"#9C755F",
628+
"#BAB0AC"
629+
],
630+
"heatmap": [
631+
"#eff6ff",
632+
"#1e40af"
633+
]
634+
},
635+
"scale": {
636+
"band": {
637+
"padding": 0.1,
638+
"round": true
639+
},
640+
"linear": {
641+
"nice": true,
642+
"zero": true
643+
},
644+
"ordinal": {
645+
"type": "band",
646+
"padding": 0.1
647+
},
648+
"time": {
649+
"type": "utc",
650+
"nice": true
651+
},
652+
"log": {
653+
"base": 10,
654+
"domain": {
655+
"data": "table",
656+
"field": "x"
657+
},
658+
"range": {
659+
"data": "table",
660+
"field": "y"
661+
}
662+
},
663+
"range": [
664+
"#4E79A7",
665+
"#F28E2B"
666+
]
667+
}
668+
}
669+
}
670+
```
551671

552672

553673
#### Error Handling

0 commit comments

Comments
 (0)