{"id":39980762,"url":"https://github.com/bobbingwide/sb-chart-block","last_synced_at":"2026-01-18T23:04:59.136Z","repository":{"id":63920990,"uuid":"327715683","full_name":"bobbingwide/sb-chart-block","owner":"bobbingwide","description":"Chart block for Gutenberg","archived":false,"fork":false,"pushed_at":"2025-04-16T10:46:42.000Z","size":2560,"stargazers_count":6,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-16T14:19:10.421Z","etag":null,"topics":["block","chartjs","gutenberg","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobbingwide.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-07T20:17:23.000Z","updated_at":"2025-04-16T10:46:44.000Z","dependencies_parsed_at":"2025-04-16T11:48:48.426Z","dependency_job_id":"5163f8a5-9e07-47bc-af3f-337b7edf91db","html_url":"https://github.com/bobbingwide/sb-chart-block","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/bobbingwide/sb-chart-block","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbingwide%2Fsb-chart-block","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbingwide%2Fsb-chart-block/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbingwide%2Fsb-chart-block/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbingwide%2Fsb-chart-block/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobbingwide","download_url":"https://codeload.github.com/bobbingwide/sb-chart-block/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbingwide%2Fsb-chart-block/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28553055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["block","chartjs","gutenberg","wordpress"],"created_at":"2026-01-18T23:04:59.064Z","updated_at":"2026-01-18T23:04:59.129Z","avatar_url":"https://github.com/bobbingwide.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SB Chart block \n![banner](assets/sb-chart-block-banner-772x250.jpg)\n* Contributors:      bobbingwide\n* Tags:              block, Line chart, Bar chart, Pie chart, Horizontal bar chart\n* Requires at least: 5.6.0\n* Tested up to:      6.8\n* Stable tag:        1.3.1\n* Requires PHP:      7.2.0\n* License:           GPL-2.0-or-later\n* License URI:       https://www.gnu.org/licenses/gpl-2.0.html\n\nDisplays a Chart for CSV content.\n\n## Description \nUse the Chart block ( oik-sb/chart ) to display a chart.\n\n## Installation \n\n1. Upload the plugin files to the `/wp-content/plugins/sb-chart-block` directory, or install the plugin through the WordPress plugins screen directly.\n1. Activate the plugin through the 'Plugins' screen in WordPress\n\nOR with the authority to install plugins\n\n1. In the block editor, open the block inserter.\n1. Search for the block by typing 'Chart'.\n1. Click on the 'Add block' button for the SB Chart block.\n1. The SB Chart block plugin will be installed and activated.\n1. And the block will be inserted into your content.\n\n## Frequently Asked Questions \n# What types of chart can I display? \n\nSo far...\n\n- Line and stacked line, with optional fill\n- Bar and stacked bar\n- Horizontal bar and stacked horizontal bar\n- Pie\n\n# How do I choose the chart colors? \n\nThere are 6 predefined color palettes:\nchoose the color palette from a drop down list.\n\nUse the Background color overrides and border color overrides fields to set custom color values.\n\n# What options are there? \nOptions to control the chart display are:\n\n- Stacked - Toggle on to stack line or bar charts\n- Begin Y axis at 0 toggle\n- Fill toggle for line charts\n- Time line toggle for a date based axis, with selectable Time unit (stepSize)\n- Y-axes for multi axis charts\n- Color palette dropdown\n- Background color overrides. Enter comma separated hex codes.\n- Border color overrides. Enter comma separated hex codes.\n- Opacity - set the opacity of the background colours.\n- Height of the chart, in pixels\n- Bar thickness in pixels\n- Tension - for curved line charts\n- Legend font size\n- X-axis font size\n\n# What Chart script does it use?  \n\nv1.2.6 delivers [chartjs v4.4.2](https://www.jsdelivr.com/package/npm/chart.js?path=dist)\nand [chartjs-adapter-date-fns v3.0.0](https://github.com/chartjs/chartjs-adapter-date-fns)\n\n# What do I need to search for to find the block? \n\nChart or SB Chart\n\n# What if my first language is not English? \n\nIf your first language is not English then you could try:\n\n- French - graphique\n- German - Diagramm\n- Dutch - grafiek\n- Italian - grafico\n- Spanish - gráfico\n\n# Do I need to build this block? \nNo. The plugin is delivered with the production version of the block.\nIf you do wish to modify the code then you can find instructions in the src folder.\n\n### Are there shortcodes available?\n\nCharts can be embedded with the shortcode `chartjs`. The general syntax is as follows:\n\n    [chartjs attribute=\"attribute value\"]CSV content[/chartjs]\n\nSeveral attributes can be added at the same time. Example:\n\n    [chartjs attribute1=\"attribute1 value\" attribute2=\"attribute2 value\"]CSV content[/chartjs]\n\nHere's the list of supported attributes:\n\n* - `backgroundColors` (string): list of custom background colors (separated by comma) to use for datasets. For example, if there are 3 datasets (`d1`, `d2` and `d3`) and we want `d1` to use the color `#0000FF`, `d2` to use `#FFFF00` and `d3` to use `#008000`, the value of the attribute must be `#0000FF,#FFFF00,#008000`. If some colors are missing (ex.: `#0000FF,,#008000`), default colors from the theme (set with the attribute `theme`) are used as fallback (`#0000FF,second theme color,#008000`); default is no custom colors used\n* - `barThickness` (int): thickness (in pixels) of a bar in bar charts; default is the default Chart.js thickness\n* - `beginYAxisAt0` (bool): make sure the Y axis begins at 0; default is `false`\n* - `borderColors` (string): list of custom border colors (separated by comma) to use for datasets. See the description of the attribute `backgroundColors` for more details; default is the value of the attribute `backgroundColors`\n* - `class` (string): class or classes to be added to the chart container; default is an empty string\n* - `fill` (bool): fill the area under the line; default is `false`\n* - `height` (int): chart height (in pixels); default is the default Chart.js height\n* - `indexAxis` (string): axis to use as index; choices are `x`, `y`; note that `y` is automatically used for horizontal bar charts; default is `x`\n* - `max` (float): maximum value for Y axes; default is no maximum value\n* - `opacity` (float): opacity to apply to the lines or bars; it must be between `0` and `1`; default is `0.8`\n* - `showLine` (bool): show (draw) lines; default is `true`\n* - `stacked` (bool): enable stacking for line/bar charts; default is `false`\n* - `tension` (float): add Bezier curve tension to lines; when set to `0`, lines are straight; default is `0`\n* - `theme` (string): theme used for the chart colors; choices are `Chart`, `Gutenberg`, `Rainbow`, `Tertiary`, `Visualizer`, `Wordpress`; default is `Chart`\n* - `time` (bool): add support for time line on the X axis; default is `false`\n* - `timeUnit` (string): time unit to use if time line is enabled; choices are `year`, `quarter`, `month`, `week`, `day`, `hour`, `minute`, `second`, `millisecond`; default is `hour`\n* - `type` (string): type of chart; choices are `bar`, `horizontalbar`, `line`, `pie`; default is `line`\n* - `yAxes` (string): list of Y axes to which the datasets are bound. It allows to enable multi-axis charts. For example, if there are 3 datasets (`d1`, `d2` and `d3`) and we want `d1` to use the first Y axis, and `d2` and `d3` to use the second Y axis, the attribute value must be `y,y1,y1`; default is an empty string, so multi-axis feature is disabled and all datasets are automatically bound to the first (and only) Y axis `y`\n\nHere's a fully functional example:\n\n    [chartjs backgroundColors=\"#008000\" fill=\"true\" opacity=\"0.35\" tension=\"0.2\" theme=\"Visualizer\" time=\"true\" timeUnit=\"month\" yAxes=\"y,y1\"]Year,Sales,Expenses\n    2020-08,5421.32,1151.21\n    2021-02,4823.99,887.23\n    2021-03,4945.32,958.00\n    2021-10,7086.65,1854.35\n    2022-05,7385.21,2009.01\n    [/chartjs]\n\nHere's the result:\n\n![Chart rendered with settings from the shortcode example](assets/screenshot-6.jpg)\n\n### Are there hooks available for developers?\n\nThe following filter hooks are available:\n\n* - `sb_chart_block_content`: filter allowing to manipulate the content before it's processed\n* - `sb_chart_block_options`: filter allowing to add custom Chart.js options\n\nFor example, to customize the legend, use the `sb_chart_block_options` filter in your `functions.php` theme file as follows:\n\n```php\nfunction customize_legend($options, $atts, $series) {\n\t$custom_options = to_array($options);\n\n\t$custom_options['plugins']['legend']['labels']['font']['size'] = 16;\n\t$custom_options['plugins']['legend']['labels']['color'] = '#0000FF';\n\n\treturn json_decode(json_encode($custom_options));\n}\nadd_filter('sb_chart_block_options', 'customize_legend', 10, 3);\n\nfunction to_array($data) {\n\t$array = [];\n\n\tif (is_array($data) || is_object($data)) {\n\t\tforeach ($data as $key =\u003e $value) {\n* \t\t\t$array[$key] = (is_array($value) || is_object($value)) ? to_array($value) : $value;\n\t\t}\n\t} else {\n\t\t$array[] = $data;\n\t}\n\n\treturn $array;\n}\n```\n\nHere's another way (without array conversion):\n\n```php\nfunction customize_legend($options, $atts, $series) {\n\tif (!isset($options-\u003eplugins)) $options-\u003eplugins = new stdClass();\n\tif (!isset($options-\u003eplugins-\u003elegend)) $options-\u003eplugins-\u003elegend = new stdClass();\n\tif (!isset($options-\u003eplugins-\u003elegend-\u003elabels)) $options-\u003eplugins-\u003elegend-\u003elabels = new stdClass();\n\tif (!isset($options-\u003eplugins-\u003elegend-\u003elabels-\u003efont)) $options-\u003eplugins-\u003elegend-\u003elabels-\u003efont = new stdClass();\n\n\t$options-\u003eplugins-\u003elegend-\u003elabels-\u003efont-\u003esize = 16;\n\t$options-\u003eplugins-\u003elegend-\u003elabels-\u003ecolor = '#0000FF';\n\n\treturn $options;\n}\nadd_filter('sb_chart_block_options', 'customize_legend', 10, 3);\n```\n\n\n## Screenshots \n1. Line chart - Gutenberg theme colors\n2. Bar chart - Chart theme colors\n3. Horizontal bar chart - Tertiary theme colors\n4. Pie chart - Visualizer theme colors\n5. Chart type toolbar selection\n\n## Upgrade Notice \n# 1.3.1 \nUpdate for support for PHP 8.4 and a minor security fix\n\n## Changelog \n# 1.3.1 \n* Changed: Run esc_attr() against the classNames attribute. Props: Peter Thaleikis (Wordfence)  #38\n* Changed: Support PHP 8.4's str_getcsv() changes #38\n* Tested: With WordPress 6.8 and WordPress Multisite\n* Tested: With PHP 8.3 and PHP 8.4\n* Tested: With PHPUnit 9.6\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbingwide%2Fsb-chart-block","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobbingwide%2Fsb-chart-block","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbingwide%2Fsb-chart-block/lists"}