Request edit widget by id
PATCH
/
api
/
widgets
/
{widgetId}
Authorizations
x-api-key
string
headerrequiredResponse
200 - application/json
The response is of type object
.
{
"id": "0a09493d-360a-474d-a297-b39e7d767832",
"title": "Sales volume M-o-M",
"x": 0,
"y": 3,
"w": 6,
"h": 3,
"assumptions": [],
"code": "import pandas as pd\nimport numpy as np\ndef main():\n df1 = pd.read_csv('/tmp/1fcf8b4f-4ac6-4fc9-8be2-e7356baa115f.csv', usecols=['Order Date', 'Sales'])\n df1['Order Date'] = pd.to_datetime(df1['Order Date'])\n df1['Month-Year'] = df1['Order Date'].dt.to_period('M')\n df1_grouped = df1.groupby('Month-Year')['Sales'].sum().reset_index()\n chart = {\n \"type\": \"line\",\n \"data\": {\n \"labels\": df1_grouped['Month-Year'].dt.strftime('%m-%Y').tolist(),\n \"datasets\": [{\n \"label\": \"Sales Volume\",\n \"data\": df1_grouped['Sales'].tolist(),\n \"fill\": True,\n \"backgroundColor\": \"rgba(54, 162, 235, 0.2)\",\n \"borderColor\": \"rgba(54, 162, 235, 1)\"\n }]\n },\n \"options\": {\n \"responsive\": True,\n \"maintainAspectRatio\": False,\n \"plugins\": {\n \"datalabels\": {\n \"display\": False\n },\n \"title\": {\n \"display\": True,\n \"text\": \"Sales Volume Month Over Month\"\n }\n }\n }\n }\n return chart",
"dashboard": "fc5624ac-abd8-453c-b56d-898b990a94f0",
"cache": "{\"type\":\"line\",\"data\":{\"labels\":[\"01-2015\",\"02-2015\",\"03-2015\",\"04-2015\",\"05-2015\",\"06-2015\",\"07-2015\",\"08-2015\",\"09-2015\",\"10-2015\",\"11-2015\",\"12-2015\",\"01-2016\",\"02-2016\",\"03-2016\",\"04-2016\",\"05-2016\",\"06-2016\",\"07-2016\",\"08-2016\",\"09-2016\",\"10-2016\",\"11-2016\",\"12-2016\",\"01-2017\",\"02-2017\",\"03-2017\",\"04-2017\",\"05-2017\",\"06-2017\",\"07-2017\",\"08-2017\",\"09-2017\",\"10-2017\",\"11-2017\",\"12-2017\",\"01-2018\",\"02-2018\",\"03-2018\",\"04-2018\",\"05-2018\",\"06-2018\",\"07-2018\",\"08-2018\",\"09-2018\",\"10-2018\",\"11-2018\",\"12-2018\"],\"datasets\":[{\"label\":\"Sales Volume\",\"data\":[14236.895,4519.892,55691.009,28295.345,23648.287,34595.1276,33946.393,27909.4685,81777.3508,31453.393,78628.7167,69545.6205,18174.0756,11951.411,38726.252,34195.2085,30131.6865,24797.292,28765.325,36898.3322,64595.918,31404.9235,75972.5635,74919.5212,18542.490999999998,22978.815,51715.875,38750.039000000004,56987.728,40344.534,39261.963,31115.3743,73410.0249,59687.745,79411.9658,96999.043,43971.374,20301.1334,58872.3528,36521.5361,44261.1102,52981.7257,45264.416,63120.888,87866.652,77776.9232,118447.825,83829.3188],\"fill\":true,\"backgroundColor\":\"rgba(54, 162, 235, 0.2)\",\"borderColor\":\"rgba(54, 162, 235, 1)\"}]},\"options\":{\"responsive\":true,\"maintainAspectRatio\":false,\"plugins\":{\"datalabels\":{\"display\":false},\"title\":{\"display\":true,\"text\":\"Sales Volume Month Over Month\"}}}}",
"team": "ee5b08c6-5167-4425-bbc3-a746fe4a7ead",
"settings": {},
"created_at": "2024-03-05T12:09:10.192+00:00",
"messages": [
{
"role": "user",
"content": "Create a line chart that shows sales volume month over month. The x-axis should show the month in MM-YYYY format. Do not use moment.js"
},
{
"role": "user",
"content": "Add a blue fill to the chart"
}
]
}
You can find all properties for Widgets in the concepts at this link