Building on the Quick Start example, you can add a trend line to your chart using attributes of the seriesList option.
Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> var data = [{ year: 1994, rating: 9.2 }, { year: 1972, rating: 9.2 }, { year: 1974, rating: 9.0 }, { year: 1994, rating: 8.9 }, { year: 1966, rating: 8.9 }, { year: 2008, rating: 8.9 }, { year: 1957, rating: 8.9 }, { year: 1993, rating: 8.9 }, { year: 2003, rating: 8.8 }, { year: 1999, rating: 8.8 }, { year: 1980, rating: 8.8 }, { year: 2001, rating: 8.8 }, { year: 1975, rating: 8.7 }, { year: 1990, rating: 8.7 }, { year: 2010, rating: 8.7 }, { year: 1954, rating: 8.7 }, { year: 1977, rating: 8.7 }, { year: 1994, rating: 8.7 }, { year: 1999, rating: 8.7 }, { year: 2002, rating: 8.7 }, { year: 2002, rating: 8.6 }, { year: 1968, rating: 8.6 }, { year: 1995, rating: 8.6 }, { year: 1991, rating: 8.6 }, { year: 1942, rating: 8.6 }, { year: 1995, rating: 8.6 }, { year: 1981, rating: 8.6 }, { year: 1954, rating: 8.6 }, { year: 1946, rating: 8.6 }, { year: 1960, rating: 8.6 }, { year: 1994, rating: 8.6 }, { year: 1950, rating: 8.5 }, { year: 1998, rating: 8.5 }, { year: 2000, rating: 8.5 }, { year: 1991, rating: 8.5 }, { year: 1998, rating: 8.5 }, { year: 1979, rating: 8.5 }, { year: 1931, rating: 8.5 }, { year: 1964, rating: 8.5 }, { year: 1979, rating: 8.5 }, { year: 2001, rating: 8.5 }, { year: 1936, rating: 8.5 }, { year: 1997, rating: 8.5 }, { year: 1959, rating: 8.5 }, { year: 1985, rating: 8.5 }, { year: 2002, rating: 8.4 }, { year: 1941, rating: 8.4 }, { year: 1980, rating: 8.4 }, { year: 2013, rating: 8.4 }, { year: 2006, rating: 8.4 }, { year: 1931, rating: 8.4 }, { year: 1957, rating: 8.4 }, { year: 2011, rating: 8.4 }, { year: 1958, rating: 8.4 }, { year: 1999, rating: 8.4 }, { year: 2012, rating: 8.4 }, { year: 2000, rating: 8.4 }, { year: 2012, rating: 8.4 }, { year: 1999, rating: 8.4 }, { year: 1986, rating: 8.4 }, { year: 1944, rating: 8.4 }, { year: 1976, rating: 8.4 } ]; require(["wijmo.wijscatterchart"], function () { $(document).ready(function () { $("#wijscatterchart").wijscatterchart({ dataSource: data, seriesList: [{ label: "Annual rating", data: { x: {bind: "year"}, y: {bind: "rating"} } },{ isTrendline: true, label: "Trendline", order: 4, data: { x: {bind: "year"}, y: {bind: "rating"} } } ] }); }); }); </script> |