Skip to content

feat(chat): extensive updates to code charts and chat #582

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .storybook/welcome/welcome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@

.welcome__heading {
@include type.type-style('productive-heading-07');

color: colors.$gray-80;
}

.welcome__link {
width: fit-content;
inline-size: fit-content;
}

.welcome__link,
.welcome__link:hover,
.welcome__link.cds--link:visited {
margin-top: 1rem;
color: colors.$blue-70;
margin-block-start: 1rem;
}

.welcome__link:first-child {
margin-top: 2rem;
margin-block-start: 2rem;
}
6 changes: 3 additions & 3 deletions packages/react/.storybook/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ body,
}

.cds--mdx img {
max-width: 100%;
background: #fff;
background: #ffffff;
max-inline-size: 100%;
}

.cds--mdx .image--fixed img {
@include breakpoint.breakpoint(lg) {
max-width: 736px;
max-inline-size: 736px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const StoryContent = () => (
</Grid>
</Theme>
);

/**
* Story for UIShell
* @returns {React.ReactElement} The JSX for the story
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const Thumbnails = {
thumbnail
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","description":"Boxplot example with random data","data":{"values":[{"group":"Group A","value":34},{"group":"Group A","value":28},{"group":"Group A","value":55},{"group":"Group B","value":91},{"group":"Group B","value":81},{"group":"Group B","value":67},{"group":"Group C","value":45},{"group":"Group C","value":66},{"group":"Group C","value":73},{"group":"Group D","value":28},{"group":"Group D","value":35},{"group":"Group D","value":56},{"group":"Group E","value":12},{"group":"Group E","value":45},{"group":"Group E","value":99}]},"mark":"boxplot","encoding":{"y":{"field":"group","type":"nominal"},"x":{"field":"value","type":"quantitative"}}}'}"
container-height="156px"
selected
container-width="156px">
</clabs-chat-chart>
<clabs-chat-chart
Expand Down Expand Up @@ -224,6 +225,13 @@ export const Showcase = {
container-height="400px">
</clabs-chat-chart>
<br />
<h4>Faceted year-filtered h-concatenated repeating month-filtered chart</h4>
<clabs-chat-chart
theme="${chartTheme}"
container-height="2600px"
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","data":{"url":"https://vega.github.io/editor/data/weather.csv"},"transform":[{"calculate":"year(datum.date)","as":"year"},{"fold":["temp_max","temp_min"],"as":["type","temperature"]},{"calculate":"[\'Winter\',\'Winter\',\'Spring\',\'Spring\',\'Spring\',\'Summer\',\'Summer\',\'Summer\',\'Fall\',\'Fall\',\'Fall\',\'Winter\'][month(datum.date)]","as":"season"},{"filter":"datum.year >= 2012 && datum.year <= 2015"}],"facet":{"row":{"field":"year","type":"ordinal"}},"spec":{"vconcat":[{"hconcat":[{"mark":"rect","width":600,"height":200,"encoding":{"y":{"field":"date","timeUnit":"date","type":"ordinal","title":"Day","axis":{"labelAngle":0,"format":"%e"}},"x":{"field":"date","timeUnit":"month","type":"ordinal","title":"Month"},"color":{"field":"temp_max","aggregate":"max","type":"quantitative","legend":{"title":null}}}},{"mark":"point","encoding":{"x":{"field":"wind","type":"quantitative"},"y":{"field":"precipitation","type":"quantitative"},"color":{"field":"temp_max","aggregate":"max","type":"quantitative","legend":{"title":null}}}}]},{"repeat":{"column":["precipitation","wind","temperature"]},"spec":{"vconcat":[{"layer":[{"mark":"boxplot","encoding":{"x":{"timeUnit":"month","field":"date","type":"temporal","title":"Month"},"y":{"field":{"repeat":"column"},"aggregate":"sum","type":"quantitative"},"y2":{"field":"temp_min"},"color":{"field":"season","type":"nominal"}}},{"mark":{"type":"point","color":"black","strokeWidth":2},"encoding":{"x":{"timeUnit":"month","field":"date","type":"temporal"},"y":{"aggregate":"mean","field":{"repeat":"column"},"type":"quantitative"}}}]},{"layer":[{"mark":"bar","height":60,"encoding":{"x":{"timeUnit":"month","field":"date","type":"temporal"},"y":{"aggregate":"mean","field":{"repeat":"column"},"type":"quantitative"},"color":{"field":"season","type":"nominal"}}},{"mark":{"type":"line","color":"black","strokeWidth":2},"encoding":{"x":{"timeUnit":"month","field":"date","type":"temporal"},"y":{"aggregate":"mean","field":{"repeat":"column"},"type":"quantitative"}}}]}]}}],"resolve":{"scale":{"y":"independent"}}}}'}">
</clabs-chat-chart>
<br />
<h4>Box Plot</h4>
<br />
<clabs-chat-chart
Expand Down Expand Up @@ -386,6 +394,33 @@ export const ComplexExamples = {
*/
render: () =>
html`
<h4>Interactive multi-scatter plot</h4>
<br />
<clabs-chat-chart
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","repeat":{"row":["Horsepower","Acceleration","Miles_per_Gallon"],"column":["Miles_per_Gallon","Acceleration","Horsepower"]},"spec":{"data":{"url":"https://vega.github.io/vega-lite/examples/data/cars.json"},"mark":"point","params":[{"name":"brush","select":{"type":"interval","resolve":"union","on":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","translate":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![event.shiftKey]"}},{"name":"grid","select":{"type":"interval","resolve":"global","translate":"[pointerdown[!event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![!event.shiftKey]"},"bind":"scales"}],"encoding":{"x":{"field":{"repeat":"column"},"type":"quantitative"},"y":{"field":{"repeat":"row"},"type":"quantitative","axis":{"minExtent":30}},"color":{"condition":{"param":"brush","field":"Origin","type":"nominal"},"value":"grey"}}}}'}"
container-height="450px"
container-width="600px">
</clabs-chat-chart>
<br />
<clabs-chat-chart
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","repeat":{"row":["Horsepower","Acceleration","Miles_per_Gallon"],"column":["Miles_per_Gallon","Acceleration","Horsepower"]},"spec":{"data":{"url":"https://vega.github.io/vega-lite/examples/data/cars.json"},"mark":"point","params":[{"name":"brush","select":{"type":"interval","resolve":"union","on":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","translate":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![event.shiftKey]"}},{"name":"grid","select":{"type":"interval","resolve":"global","translate":"[pointerdown[!event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![!event.shiftKey]"},"bind":"scales"}],"encoding":{"x":{"field":{"repeat":"column"},"type":"quantitative"},"y":{"field":{"repeat":"row"},"type":"quantitative","axis":{"minExtent":30}},"color":{"condition":{"param":"brush","field":"Origin","type":"nominal"},"value":"grey"}}}}'}"
container-height="950px">
</clabs-chat-chart>
<br />
<h4>Multi histogram</h4>
<br />
<clabs-chat-chart
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","repeat":["Horsepower","Miles_per_Gallon","Acceleration","Displacement"],"columns":2,"spec":{"data":{"url":"https://vega.github.io/vega-lite/examples/data/cars.json"},"mark":"bar","encoding":{"x":{"field":{"repeat":"repeat"},"bin":true},"y":{"aggregate":"count"},"color":{"field":"Origin"}}}}'}"
container-height="450px"
container-width="800px">
</clabs-chat-chart>
<br />
<clabs-chat-chart
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","repeat":["Horsepower","Miles_per_Gallon","Acceleration","Displacement"],"columns":2,"spec":{"data":{"url":"https://vega.github.io/vega-lite/examples/data/cars.json"},"mark":"bar","encoding":{"x":{"field":{"repeat":"repeat"},"bin":true},"y":{"aggregate":"count"},"color":{"field":"Origin"}}}}'}"
container-height="600px"
container-width="400px">
</clabs-chat-chart>
<br />
${complexExamples.map(
(item) =>
html` <h4>${item.title}</h4>
Expand Down Expand Up @@ -416,6 +451,15 @@ export const FacetingTest = {
content="${JSON.stringify(item.spec)}">
</clabs-chat-chart>`
)}
<<<<<<< HEAD
<h4>Multi-scatter-chart</h4>
<clabs-chat-chart
content="${'{"$schema":"https://vega.github.io/schema/vega-lite/v5.json","repeat":{"row":["Horsepower","Acceleration","Miles_per_Gallon"],"column":["Miles_per_Gallon","Acceleration","Horsepower"]},"spec":{"data":{"url":"https://vega.github.io/vega-lite/examples/data/cars.json"},"mark":"point","params":[{"name":"brush","select":{"type":"interval","resolve":"union","on":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","translate":"[pointerdown[event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![event.shiftKey]"}},{"name":"grid","select":{"type":"interval","resolve":"global","translate":"[pointerdown[!event.shiftKey], window:pointerup] > window:pointermove!","zoom":"wheel![!event.shiftKey]"},"bind":"scales"}],"encoding":{"x":{"field":{"repeat":"column"},"type":"quantitative"},"y":{"field":{"repeat":"row"},"type":"quantitative","axis":{"minExtent":30}},"color":{"condition":{"param":"brush","field":"Origin","type":"nominal"},"value":"grey"}}}}'}"
container-height="450px"
container-width="600px">
</clabs-chat-chart>
<br />
======= >>>>>>> upstream/main
Comment on lines +454 to +462
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another conflict marker over here. Was this section meant to be removed? Can you double check?

Also noticing that weather example and concat aren’t loading in the Faceting test story.

<h4>Interactive multi-scatter plot</h4>
<br />
<clabs-chat-chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,78 @@
}
}
},
{
"title": "",
"prompt": "Make a pair-plot of all columns with scatter plots, use bar distributions when coloumns match",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"prompt": "Make a pair-plot of all columns with scatter plots, use bar distributions when coloumns match",
"prompt": "Make a pair-plot of all columns with scatter plots, use bar distributions when columns match",

"result": {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://vega.github.io/editor/data/weather.csv"
},
"repeat": {
"row": [
"Row1",
"Row2"
],
"column": [
"Col1",
"Col2",
"Col3"
]
},
"spec": {
"vconcat": [
{"title":"layered Chart",
"layer": [
{
"mark": "line",
"encoding": {
"x": {
"field": "date",
"type": "temporal"
},
"y": {
"field": "temp_max",
"type": "quantitative"
},
"color":{"field": "weather", "type":"nominal"}
}
},
{
"mark": "point",
"encoding": {
"x": {
"field": "date",
"type": "temporal"
},
"y": {
"field": "temp_min",
"type": "quantitative"
},
"color":{"field": "weather", "type":"nominal"}
}
}
]
},
{
"title":"lower chart",
"height":50,
"mark":"bar",
"encoding": {
"x": {
"field": "date",
"type": "temporal"
},
"y": {
"field": "precipitation",
"type": "quantitative"
},
"color":{"field": "weather", "type":"nominal"}
}
}
]}
}
},
{
"title": "",
"prompt": "Create two violin plots with sepal width",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,150 @@
[
{"name":"weather example",
"spec":
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": { "url": "https://vega.github.io/editor/data/weather.csv" },
"concat": [
{
"title": "Average Precipitation by Month",
"mark": "line",
"encoding": {
"x": {
"timeUnit": "month",
"field": "date",
"type": "temporal",
"axis": { "format": "%b", "title": "Month" }
},
"y": {
"aggregate": "mean",
"field": "precipitation",
"type": "quantitative",
"title": "Average Precipitation"
}
}
},
{
"title": "2012 Daily Max Temperature Heatmap",
"transform": [
{ "filter": "timeFormat(datum.date, '%Y') === '2012'" },
{ "timeUnit": "month", "field": "date", "as": "month" },
{ "timeUnit": "date", "field": "date", "as": "day" }
],
"mark": "rect",
"encoding": {
"x": {
"field": "day",
"type": "ordinal",
"title": "Day",
"axis": { "values": [1, 5, 10, 15, 20, 25, 31] }
},
"y": {
"field": "month",
"type": "ordinal",
"title": "Month",
"axis": {
"labelExpr": "['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][datum.value - 1]"
}
},
"color": {
"field": "temp_max",
"type": "quantitative",
"title": "Max Temperature",
"scale": { "scheme": "inferno" }
}
}
},
{
"title": "Temperature Distribution by Month",
"transform": [
{ "timeUnit": "month", "field": "date", "as": "month" },
{ "fold": ["temp_max", "temp_min"], "as": ["variable", "temperature"] }
],
"layer": [
{
"mark": "boxplot",
"encoding": {
"x": {
"field": "month",
"type": "ordinal",
"title": "Month",
"axis": {
"labelExpr": "['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][datum.value - 1]"
}
},
"y": {
"field": "temperature",
"type": "quantitative",
"title": "Temperature"
},
"color": {
"field": "variable",
"type": "nominal",
"title": "Temperature Type"
}
}
},
{
"transform": [
{
"aggregate": [
{ "op": "mean", "field": "temperature", "as": "mean_temperature" }
],
"groupby": ["month", "variable"]
}
],
"mark": { "type": "point", "filled": true, "size": 50, "color": "black" },
"encoding": {
"x": {
"field": "month",
"type": "ordinal",
"axis": {
"labelExpr": "['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][datum.value - 1]"
}
},
"y": { "field": "mean_temperature", "type": "quantitative" },
"color": { "field": "variable", "type": "nominal" }
}
}
]
},
{
"title": "Weather Streamgraph Over Time (Weighted by Temp Max)",
"transform": [
{ "timeUnit": "yearmonth", "field": "date", "as": "yearmonth" }
],
"mark": "area",
"encoding": {
"x": {
"field": "yearmonth",
"type": "temporal",
"axis": {
"domain": false,
"format": "%b %y",
"tickSize": 0,
"labelOverlap": "parity"
},
"title": "Year-Month"
},
"y": {
"aggregate": "sum",
"field": "temp_max",
"stack": "center",
"title": "Sum of Temp Max"
},
"color": {
"field": "weather",
"type": "nominal",
"scale": { "scheme": "category20b" },
"title": "Weather"
}
}
}
],
"columns": 2
}

},
{"name": "concat",
"spec":{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
Expand Down Expand Up @@ -688,4 +834,4 @@
}
}
}
]
]
Loading