0

I need to learn how to create a SVG element with a javascript function

The style of my html file essentially:

     <body>
     <svg></svg>
     <script></script>
     </body>

My script contains a function that creates a chart, if the function was hypothetically called create(chartName, chartAxises) how would I create a chart inside my svg element?

Thank you in advance, and I apologize for my unorganized thoughts. I just need to know the syntax, I have tried multiple things for hours so now I'm hoping for a different perspective

IWantToLearn
  • 21
  • 1
  • 6

1 Answers1

0

Rather than reinvent the wheel, what you could do is, use some svg libraries to populate your graph based on the data and attributes. https://d3js.org/

Tharsan Sivakumar
  • 6,351
  • 3
  • 19
  • 28