javascript - jqplot error with multiple pie charts on external js file -
i using jquery pie chart/donut display data on several pages. there 1 chart each page, has different data.
my plan put coding each of pie charts external js file referenced on each page in page template.
however, when script jqplot donut chart on linked js file gets chart doesn't have matching id on page, none of scripts following charts work.
this means first chart listed in script works. other pages not displaying charts, there script above doesn't have matching id on page.
for example, chart 1 , chart 2 both have coding in js file, code chart 1 first, code chart 2 second. on page 1, pie chart 1 displays has id on page pie chart 1. however, on page 2, there no matching element pie chart 1, , script throws error , doesn't code pie chart 2, not displayed in matching element on page 2.
usually when similar, if code doesn't have matching id on page code ignored. there seems in jqplot causes error if code not matched element.
this seems basic implementation me. i'm sure many people use pie chart on multiple pages different data sets , put coding them in single js file, rather in-page or referencing multiple individual js files.
any on issue appreciated many thanks
richard