Problem/Motivation

The typical Chart block from the charts_blocks submodule uses a preview, "Data Collector Table", and has other features that makes it too complex for Canvas. Let's create a simpler block designed to be used with Canvas.

The new chart has a limited set of Chart types available, reduced form options, and a text area for either entering CSV or JSON data.

CommentFileSizeAuthor
#4 chart_canvas_block.mp411.77 MBandileco

Issue fork charts-3593828

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andileco created an issue. See original summary.

andileco’s picture

Issue summary: View changes
andileco’s picture

Status: Active » Needs work
StatusFileSize
new11.77 MB

One issue I would like to address is when I want to go back and edit the block, the text area shows [object Object] instead of the JSON string. I tried to address this, but my solution isn't working.

effulgentsia’s picture

andileco’s picture

@effulgentsia - I applied https://git.drupalcode.org/project/canvas/-/merge_requests/1231.patch on top of 1.5.1, but it doesn't seem to have worked; could it be something in MY code that's causing issues?

effulgentsia’s picture

From the Canvas directory, you need to run npm install; npm run build on the command line. Sorry, I should have mentioned that in #5. We prebuild the Canvas app for tagged releases, but not if you're running an untagged release or custom patches. If you're able to do that to confirm that patch works, that would be helpful. If not, we might just merge it anyway so that it makes it into the next tagged release and you can test it then.

andileco’s picture

@effulgentsia I was able to run npm install, but I don't see a build script inside the package.json file. Is there another command I need to use?

effulgentsia’s picture

The main package.json contains npm workspaces, so npm run build should run the build script for each workspace. For this patch, you only need to build the ui workspace, so if you prefer you can instead cd ui; npm run build.

effulgentsia’s picture

npm run build should run the build script for each workspace

Apologies. I got that wrong. From the root Canvas directory you'd need to do either npm run build --workspaces to build all workspaces or npm run build --workspace=ui if you want to only build the ui one.

andileco’s picture

@effulgentsia - I did #9 and it worked - the code now shows in the textfield as a string of JSON rather than [object Object].

andileco’s picture

Status: Needs work » Needs review

Now that the JSON issue is resolved on the Canvas side, marking this for review.

nikathone’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

andileco’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.