How to draw Chart using react-pdf library - html

I am going to draw some charts including doughnut, Pie, and Bar chart using the react-pdf library.
I was trying to draw it with Canvas but Seems like it's pretty complex and I don't have a better idea of it.
Please give me advice.
Thanks

Related

Alternative to Tiled to do free shapes

I am searching a tool like Tiled but allowing to make free shapes (not only rectangles or circles). Shapes with curves and such. Could you help me please?
Thank you.
I would suggest using Inkscape.
Though, if you're looking for a tool very much like Tiled but with support for curves, be sure to add a comment to the spline objects feature request and consider helping to finish this pull request.

How to draw a pie chart in Libgdx

I need to represent data in the form of pie chart. I searched in LibGdx for libraries related to chart. I do not find any.
Questions
Do we have any library in LibGdx for drawing charts / Graphs ?
Any way to draw a smooth circle / pie in LibGdx ?
Any examples would be good
LibGdx is primarily a graphics API, and does not really have easy to use libraries set up for simple things like charts/graphs, mostly because its easy to create one yourself.
Another technology may suite you far better for your task.
Having said that, to draw a 2D circle you can easily use ShapeRenderer. See the link for the javadoc and some examples:
https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html
You could also use ShapeRenderer to plot each portion and fill it at the same time as you draw them.
I don’t have any specific chart/graph tutorials, but you can search for "ShapeRenderer" or see here for a bit more info.
https://github.com/libgdx/libgdx/wiki/Scene2d
and:
https://github.com/libgdx/libgdx/wiki/Scene2d.ui

Draw some rectangles on image usng HTML 5 canvas

In my web application I want the user to be able to draw some rectangles on an image, also change the size of the rectangles and drag and drop them. after that I have to get coordinates of rectangles and send them to server's database
Is it better to create a canvas on a photo or load the image in canvas ?
I don't write any code yet because I have no idea how to do this.
Any ideas,suggestions,links,libraries ?
As the comment said canvas is a good bet for this, but you'd need to do a fair bit of coding to get it working.
I actually have a tutorial on making Canvas interactive by drawing rectangles and moving them around. It should give you a good start on this project.
There are also a few libraries, such as fabricJS, but that might be hard to get the coordinates out of without digging into the library.

Creating irregular shapes for a jigsaw puzzle game in flash

I want to make a jigsaw puzzle in flash. I know how to create square kind of shapes. But I want to create this kind of irregular shapes. See the live demo of puzzles in the links shown
http://www.flashcomponents.net/component/jigsawpuzzle/preview/4952.html
http://www.gamedesign.jp/flash/whitejigsaw/whitejigsaw.html
I just want to how to create the irregular shapes.
Does anyone know or can anybody give useful links as to how this can be done.
My ideas:
Shapes can be just Bitmaps, masked by irregular filled Shape. Each piece of puzzle has shared BitmapData. Shapes can be created by series of drawRect/drawEllipse/curveTo calls in fill mode.
Watch their relative positions to catch the moment when they should 'snap' together. Also cull combinations not close to each other.
If you're creating your shapes dynamically with code, try using the graphics.curveTo() method. This can be used in combination with graphics.lineTo() to make the outline for your pieces.
You could also make your pieces using the pen tool within the Flash IDE to create movie clips that can my used for creating object instances to be used as masks for your puzzle. This works if you plan on having the same puzzle layouts more than once.
That's done using masking: http://www.flash-here.com/tutorials/flash_masking.html
Have a look to the following:
http://www.sephiroth.it/file_detail.php?id=111#
A little bit old.

How can I draw a diminishing wavy ray or complex figures in HTML5 / Canvas

I am trying to generate some sun 'rays' which I can best describe as looking like the blade of a krisknife, such as the blade portion of this picture.
This is just an example. I only need a triangular shape with two or three waves that I can close and fill.
Better yet, is there some HTML5 app with which I can draw a complex figure and then export the javascript (moveTo, arcTo, bezierCurveTo, quadraticCurveTo, ...). Something similar to HTML5 Bezier Sketcher but which saves the javascript. Trying to draw complex figures blind is very difficult and I don't want to switch to SVG if it is not necessary.
Thanks 1,000,000
Edit: I have now also looked at all the options at this site. None will allow me to draw and fill simple curves and then see/save canvs commands. All that show commands show them in new libraries like fabric or jsDraw2D.
You can parse SVG into an html5 canvas with fabric.js.
That might do the trick for you.
https://github.com/kangax/fabric.js
Beside SVG it can help you with a nice API to canvas drawing.
I found the answer among the solutions for Convert SVG to Canvas friendly output. The author didn't think it worked for him, but I think it's as perfect as any I have seen.
Professor Cloud (...is frikkin' amazing! This isn't the first thing he's done I have found incredibly useful.) created a site to take SVG input and product Canvas output. You can see it here, at Professor Cloud SVG-to-Canvas.
Using this site, I can draw something or even take a stock vector image in AI, export as SVG, cut out the commands and past them into Prof. Clouds amazing SVG-chipper, and get Canvas code. I understand it doesn't support full SVG capabilities, but then, neither does Canvas. Great for me.
Your solution is probably best but just for the record, I tried experimenting with some graph plotting, and got some nice results:
The equations are:
sin(x)*log(2/x) + x/10
sin(x)*log(2/x) - x/10
You can plot them using: http://www.graphsketch.com/
It looks good with 0 < x < 25