Is there a way to graph functions using the playgroud? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there a way to graph functions using the playgroud?

I started creating my first calculator and then added some trig functions and logarithms. I want to upgrade the calculator so it will graph lines and possibly the trig functions. Is there any way to do this on this site? Thanks

29th Jun 2017, 8:54 PM
Sarah
Sarah  - avatar
4 Answers
+ 13
I've wondered the same thing (wanted to show histograms of various probability distributions) but those libraries are not part of what is available in the playground. Still pondering potential workarounds, but I'm not sure how much cross-talk codes may be allowed to have. Obviously I haven't been ask that energetic about it yet.
30th Jun 2017, 12:07 AM
Jim
Jim - avatar
+ 3
unless you are making it for web, you'll have to do something like write lines of 0's to make a graph looking thing then replace it with 1's for the lines maybe.
29th Jun 2017, 9:49 PM
Jordan Chapman
Jordan Chapman - avatar
+ 3
Here is an example of writing a graph in C#. should work similarly in most languages https://code.sololearn.com/cgcvA57byw3M/?ref=app
29th Jun 2017, 10:07 PM
Jordan Chapman
Jordan Chapman - avatar
+ 3
With JS inside a web project (Html/Css) you can easily draw anything using APIs related to <canvas> and/or <svg> elements ^^ This code I previously corected may show you the way to do it with <canvas>: https://code.sololearn.com/WoC1dSv8M4KS/?ref=app And this one could help you if you're more interested by vector drawing possibilities than by bitmaps handling: https://code.sololearn.com/WNAB98G0h0jC/?ref=app (no JS used to draw in it, but example of <svg> use: look also at my others code, especially this one: https://code.sololearn.com/WmAKoTUl3GiN/?ref=app more related to JS use for drawing vector graphics )
30th Jun 2017, 4:11 AM
visph
visph - avatar