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: 1999, ThousandUnits: 39.758 }, { Year: 2000, ThousandUnits: 41.215 }, { Year: 2001, ThousandUnits: 39.855 }, { Year: 2002, ThousandUnits: 41.358 }, { Year: 2003, ThousandUnits: 41.968 }, { Year:2004, ThousandUnits:44.554 }, { Year:2005, ThousandUnits:46.862 },{ Year:2006, ThousandUnits:49.918 },{ Year:2007, ThousandUnits:53.201 },{ Year:2008, ThousandUnits: 52.726 },{ Year:2009, ThousandUnits:47.772 },{ Year:2010, ThousandUnits:58.264 },{ Year:2011, ThousandUnits:59.929 }]; require(["wijmo.wijlinechart"], function () { $(document).ready(function () { $("#wijlinechart").wijlinechart({ dataSource: data, seriesList: [{ label: "World auto production", data: { x: {bind: "Year"}, y: {bind: "ThousandUnits"} } },{ isTrendline: true, label: "Trendline", order: 4, data: { x: {bind: "Year"}, y: {bind: "ThousandUnits"} } } ] }); }); }); </script> |