371 lines
8.3 KiB
JSON
371 lines
8.3 KiB
JSON
{
|
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
"apiVersion": 3,
|
|
"name": "lcp/bar-graph",
|
|
"version": "1.0.0",
|
|
"title": "Bar Graph",
|
|
"category": "widgets",
|
|
"icon": "chart-bar",
|
|
"description": "Display data as a bar graph using D3.js",
|
|
"supports": {
|
|
"html": false
|
|
},
|
|
"attributes": {
|
|
"selectedDataset": {
|
|
"type": "number",
|
|
"default": 1
|
|
},
|
|
"columnTypes": {
|
|
"type": "object",
|
|
"default": {}
|
|
},
|
|
"enableStackedBars": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"enableDrillDown": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"enableHierachical": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"hierarchicalSource": {
|
|
"type": "string",
|
|
"default": "parent"
|
|
},
|
|
"hierarchicalColumnOrder": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"hierachicalDepth": {
|
|
"type": "number",
|
|
"default": 1
|
|
},
|
|
"gridColumnDefinitions": {
|
|
"type": "array",
|
|
"default": [
|
|
{
|
|
"name": "Data",
|
|
"columns": [
|
|
{
|
|
"field": "Department",
|
|
"dataType": "text",
|
|
"renderFormat": "text",
|
|
"sorted": "",
|
|
"width": 150,
|
|
"editable": true,
|
|
"position": 0
|
|
},
|
|
{
|
|
"field": "Budget",
|
|
"dataType": "number",
|
|
"renderFormat": "currency",
|
|
"sorted": "asc",
|
|
"width": 120,
|
|
"editable": true,
|
|
"position": 1
|
|
},
|
|
{
|
|
"field": "MeetAt",
|
|
"dataType": "date",
|
|
"renderFormat": "datetime",
|
|
"sorted": "",
|
|
"width": 150,
|
|
"editable": true,
|
|
"position": 2
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Locations",
|
|
"columns": [
|
|
{
|
|
"field": "State",
|
|
"dataType": "text",
|
|
"renderFormat": "text",
|
|
"sorted": "",
|
|
"width": 150,
|
|
"editable": true,
|
|
"position": 0
|
|
},
|
|
{
|
|
"field": "Coordinates",
|
|
"dataType": "number",
|
|
"renderFormat": "number",
|
|
"sorted": "",
|
|
"width": 120,
|
|
"editable": true,
|
|
"position": 1
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"test": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"datasets": {
|
|
"type": "array",
|
|
"default": [
|
|
{
|
|
"name": "Main",
|
|
"data": [
|
|
{
|
|
"Department": "Sheriffs Office",
|
|
"Budget": 1,
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"preferredColor": "red",
|
|
"PostContent": "<div> </div>"
|
|
},
|
|
{
|
|
"Department": "Assessor",
|
|
"Budget": 2,
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"preferredColor": "#232323",
|
|
"PostContent": "<div> </div>"
|
|
},
|
|
{
|
|
"Department": "Treasurer",
|
|
"Budget": 3,
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"preferredColor": "#E72323",
|
|
"PostContent": "<div> </div>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Locations",
|
|
"data": [
|
|
{
|
|
"State": "California",
|
|
"Coordinates": "150,000",
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"PreferredColor": "#e0e0e0",
|
|
"PostContent": "<div> </div>"
|
|
},
|
|
{
|
|
"State": "Texas",
|
|
"Coordinates": "100,000",
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"PreferredColor": "#e0e0e0",
|
|
"PostContent": "<div> </div>"
|
|
},
|
|
{
|
|
"State": "Florida",
|
|
"Coordinates": "50,000",
|
|
"MeetAt": "2025-01-26T14:30:00Z",
|
|
"PreferredColor": "#e0e0e0",
|
|
"PostContent": "<div> </div>"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Dataset 3",
|
|
"data": [
|
|
{
|
|
"ID": "lcpDatapoint-1",
|
|
"Label": "Sample 1",
|
|
"Value": 100,
|
|
"Color": "#007cba",
|
|
"Content": "<p>First item</p>",
|
|
"Parent": ""
|
|
},
|
|
{
|
|
"ID": "lcpDatapoint-2",
|
|
"Label": "Sample 2",
|
|
"Value": 50,
|
|
"Color": "#ff0000",
|
|
"Content": "<p>Second item</p>",
|
|
"Parent": "lcpDatapoint-1"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"chartData": {
|
|
"type": "array",
|
|
"default": [
|
|
{
|
|
"ID": "lcpDatapoint-1",
|
|
"Label": "Sample 1",
|
|
"Value": 100,
|
|
"Color": "#007cba",
|
|
"Content": "<p>First item</p>",
|
|
"Parent": ""
|
|
},
|
|
{
|
|
"ID": "lcpDatapoint-2",
|
|
"Label": "Sample 2",
|
|
"Value": 50,
|
|
"Color": "#ff0000",
|
|
"Content": "<p>Second item</p>",
|
|
"Parent": "lcpDatapoint-1"
|
|
}
|
|
]
|
|
},
|
|
"enableGroupedBars": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"groupedBarsColumn": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"chartHeight": {
|
|
"type": "string",
|
|
"default": "400px"
|
|
},
|
|
"chartWidth": {
|
|
"type": "string",
|
|
"default": "100%"
|
|
},
|
|
"idColumn": {
|
|
"type": "string",
|
|
"default": "ID"
|
|
},
|
|
"barColor": {
|
|
"type": "string",
|
|
"default": "#007cba"
|
|
},
|
|
"valueColumn": {
|
|
"type": "string",
|
|
"default": "Value"
|
|
},
|
|
"labelsColumn": {
|
|
"type": "string",
|
|
"default": "Label"
|
|
},
|
|
"colorColumn": {
|
|
"type": "string",
|
|
"default": "Color"
|
|
},
|
|
"popoverColumn": {
|
|
"type": "string",
|
|
"default": "Content"
|
|
},
|
|
"renderLegend": {
|
|
"type": "boolean",
|
|
"default": true
|
|
},
|
|
"legendFontSize": {
|
|
"type": "string",
|
|
"default": "16px"
|
|
},
|
|
"legendLocation": {
|
|
"type": "string",
|
|
"default": "top"
|
|
},
|
|
"legendAlignment": {
|
|
"type": "string",
|
|
"default": "left"
|
|
},
|
|
"allowDownloadImage": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"downloadImageMaxWidth": {
|
|
"type": "string",
|
|
"default": "2000px"
|
|
},
|
|
"allowDownloadCsv": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"allowDownloadJson": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"allowFilter": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"allowSorting": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"renderFooter": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"footerContent": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"chartTitle": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"chartSubtitle": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"toolbarLocation": {
|
|
"type": "string",
|
|
"default": "bottom"
|
|
},
|
|
"toolbarAlignment": {
|
|
"type": "string",
|
|
"default": "left"
|
|
},
|
|
"enableDatapointTooltip": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"enableDatapointPopup": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"showXAxisLabel": {
|
|
"type": "boolean",
|
|
"default": true
|
|
},
|
|
"xAxisLabel": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"showYAxisLabel": {
|
|
"type": "boolean",
|
|
"default": true
|
|
},
|
|
"yAxisLabel": {
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"barsColorSource": {
|
|
"type": "string",
|
|
"default": "default"
|
|
},
|
|
"renderXGrid": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"xGridColor": {
|
|
"type": "string",
|
|
"default": "blue"
|
|
},
|
|
"renderYGrid": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"yGridColor": {
|
|
"type": "string",
|
|
"default": "#e0e0e0"
|
|
},
|
|
"includeDataChart": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"allowChartDataDownload": {
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
},
|
|
"textdomain": "lcp-visualize",
|
|
"editorScript": "file:./index.js",
|
|
"editorStyle": "file:./index.css",
|
|
"style": "file:./style-index.css",
|
|
"render": "render_block_lcp_bar_graph"
|
|
} |