0

I am interested in optimizing my chart pool. On my internal server; I have about 15 charts that has to go each in their own page. This means to have to change 15 times something, if I have to.

I tried to put all the common code in a single js script, so the web page has minimum code in it, but still, I need to maintain plenty of pages.

Is there a more efficient way to maintain multiple charts, that live on different pages? Ideally I would have a single page, where I use links to make new charts. I would call this function and it will generate the webpage to host the chart and the appropriate code to build the chart itself (which takes data from external files). Is JS the right tool for this job, or do I need to use something else?

I don't need anything complicate, just something that can reduce the amount of work done to maintain (and upgrade), multiple charts. Any pointer is appreciated, since I just started with webpages, CSS and such.

1 Answers1

0

I would put it on a single page and use a query string parameter to decide which chart to create. I would then make the source data for the chart respect the parameter and bind correctly to the chart.

You url could be something like this: chartpage.html?chartId=1

TGH
  • 38,769
  • 12
  • 102
  • 135
  • Thanks for the reply; is all of this done using JS? I tried to search around but I get generic cases of dynamically created pages via PHP, which is not what I am looking for. –  Jul 24 '14 at 19:24
  • You can either do it all in JavaScript or combine it with your server side framework of choice (PHP, Asp.Net Rails etc..) – TGH Jul 24 '14 at 19:31
  • IS there any specific thing to look for? I get mostly php results, not too many js. Any particular API to look for? Thanks! –  Jul 24 '14 at 21:31
  • If you are looking to do it in pure javascript. Take a look at this: http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript – TGH Jul 25 '14 at 13:27