With successive clicks on a button, the quadrants of the circle with different colors will appear, of course, using canvas and arc

Just as well.

The next step in following up on that old post would have been Google Seance.

solved

Is 'solve' a report of success, or a request for a solution?

I notice the second line of text lists degrees (°) as per cents (%).

Either change the % symbols to ° symbols, or divide each of those numbers by (360/100) to get per cents.

Hi,thanks.a report of success.thanks for your notice.


The lables1-4 are my data.
The lables 5-8 are shown degree of each data in pie chart.

In the image, percentage is wrongly displayed instead of degree.

If you consider to develop this further, I suggest in streamlining your code, as a first step like this:

I added 2 procedures to cover common code.
As a second step, you could give your blocks and variables sensible names, as a third step you could start using lists. It will make your app much shorter and better understandable.

Working from your original pie chart

image

Hi,thanks.:rose:

Hi,thanks.:rose:

Hello and thanks. I followed your block image but the result is a black circle. Please advise
circle_percent.aia (3.9 KB)



You should be using "set Canvas1.PaintColor", not "set Canvas1.LineWidth".

Hello and thanks :rose:. But why are the percentage numbers not exactly on their respective parts and are scattered?In addition, in some programs, the value of the parts of the pie chart is not fixed and changes.

The formula to calculate the angle is also incorrect.

The image on the top is Tim's code, the one on the bottom is that of yours.
The error lies in which part of the code is surrounded by the "divide by two" blocks.

1 Like

Hello and thanks again :rose:. I'm sorry that I didn't pay attention to these point.

1 Like

Hello again, is it possible to change the font of these texts inside the canvas?

image

image

Note that you might want to tweak with the x and y positions of the bigger text, since they may seem off-centered.

Hello and thanks again, font type?For example, let's convert the numbers inside the pie graph to Persian font.

You could try using this:

Note that you need a .ttf file for the extension to function.

Hello and thanks, unfortunately this extension cannot be used for Canvas.



Can you paste Persian font digits into text blocks?

Then it would be possible to loop through the characters of a text representation of a number, replacing the digits with their Persian equivalents.

If you prepare a text file in Persian with 100 lines, having line n contain the Persian text representation of number n, you could load it from the Media folder at screen Initialize, and split it into a global list of number strings, available for a Select item n from List block for your Canvas DrawText input.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.