質問

I am trying to use the jspdf library to draw a fairly dynamic pie graph. I have considered drawing the graph in html5 canvas and then saving it as a jpeg and saving the image into the pdf. This, however doesn't work for android browsers and I need to make something which works on all the tablets. jspdf doesn't seem to have an arc function and drawing a circle with lines in it doesn't let me fill the arcs with different colours. Any help is appreciated! Thanks!

役に立ちましたか?

解決

I solved this problem by using the inbuilt cubic bezier function. This link was very useful : http://itc.ktu.lt/itc354/Riskus354.pdf Once I could draw an arc, drawing a pie graph was very easy!

他のヒント

I made some time ago a library on npm @obliczeniowo/elementary for typescript angular that let you draw very easy pie diagram using lib-flat-pie-diagram component. This component have export button to PDF and it's draw the pie diagram as a vector inside a PDF.

There is a DrawingPdfInterface class that let you draw pie very easy. Just center point, start angle, ande angle and colors of stroke & fill and stroke width and that's it.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top