Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-05-20 19:52:23

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

pie-charts

Can anyone recommend a good javascript based pie-chart that is easy to update frequently, and presents the chart as an svg?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2025-05-21 09:49:44

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,700
GitHub

Offline

#3 2025-05-21 14:05:12

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 120
Website

Re: pie-charts

chart.js

I don’t see how to save a chart as svg in the official docs, but this has instructions

Offline

#4 2025-05-22 14:30:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

Thanks for all your suggestions!!! I’m testing all the above and www.chartjs.org.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2025-06-19 08:17:08

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

After a lot of research, I (unfortunately) found that google charts are the easiest as they use the familiar spreadsheet format and update the embedded chart automatically, on any data changes.

The issue that I have is that at the moment my CSP in htaccess is blocking them from embedding. I checked the net and I’m yet to find a directive that can just exclude the charts.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2025-06-19 16:11:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

colak wrote #339876:

After a lot of research, I (unfortunately) found that google charts are the easiest as they use the familiar spreadsheet format and update the embedded chart automatically, on any data changes.

The issue that I have is that at the moment my CSP in htaccess is blocking them from embedding. I checked the net and I’m yet to find a directive that can just exclude the charts.

solved:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2025-06-20 01:05:25

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 89
Website Twitter

Re: pie-charts

colak wrote #339877:

solved:)

That’s cryptic. :-)

How’d you do it?

Offline

#8 2025-06-20 07:48:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

agovella wrote #339878:

That’s cryptic. :-)

How’d you do it?

I added an exception for google subdomains.

Here’s the complete code

Header set Content-Security-Policy: "default-src 'self' data: 'unsafe-inline' 'unsafe-eval' font-src 'self'; manifest-src 'self'; object-src 'none'; img-src 'self' data: 'unsafe-inline' 'unsafe-eval' *.vimeo.com *.youtube.com *.ytimg.com *.youtube-nocookie.com *.vimeocdn.com *.google.com; frame-src 'self' data: *.vimeo.com *.youtube.com *.ytimg.com *.youtube-nocookie.com *.vimeocdn.com *.google.com;"

As is usual, the resolution of one issue, also reveals other problems. It appears that google sheets charts are not responsive. I’m trying to find a solution online as the css I have implemented does not appear to work.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2025-06-21 02:14:47

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,251
Website Mastodon

Re: pie-charts

Google is #Enshittification personified!


…. texted postive

Offline

#10 2025-06-21 03:50:30

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

bici wrote #339880:

Google is #Enshittification personified!

We agree!!!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#11 2025-06-22 02:31:44

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

bici wrote #339880:

Google is #Enshittification personified!

So… you rightfully made me feel guilty, and I’m moving to echarts.apache.org/en/index.html


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2025-06-23 02:20:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

And here’s the page. I’m still trying to figure out how to customise the colours, but the data is there.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#13 2025-06-23 15:40:53

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,700
GitHub

Re: pie-charts

colak wrote #339891:

I’m still trying to figure out how to customise the colours, but the data is there.

From memory, and don’t take this as gospel, pie chart colours can be specified in your var block:

colors: ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#00ffff']

Offline

#14 2025-06-23 16:23:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,366
Website GitHub Mastodon Twitter

Re: pie-charts

gaekwad wrote #339893:

From memory, and don’t take this as gospel, pie chart colours can be specified in your var block:

colors: ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#00ffff']...

Hi Pete thanks so much for jumping in.

It was actually simpler than that! All I needed to do was to select the item in the series and add the colour. Sample code:

{ value: 13, name: 'Other' , itemStyle: {color: '#eeeeee'}}

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#15 2025-06-24 03:05:47

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 89
Website Twitter

Re: pie-charts

Those are pretty cool. Wish I had a record of 21 years of my projects. That’d be really cool to see.

Offline

Board footer

Powered by FluxBB