Building on the Quick Start example, you can add labels to your tooltip text from an object array using the tooltipContent option.
Script |
Copy Code |
---|---|
<script id="scriptInit" type="text/javascript"> require(["wijmo.wijsparkline"], function () { $(document).ready(function () { var data = [{ month: "January", score: 73 }, { month: "February", score: 95 }, { month: "March", score: 89 }, { month: "April", score: 66 }, { month: "May", score: 50 }, { month: "June", score: 65 }, { month: "July", score: 70 }, { month: "August", score: 43 }, { month: "September", score: 65 }, { month: "October", score: 27 }, { month: "November", score: 77 }, { month: "December", score: 58 }]; $("#wijsparkline").wijsparkline({ data: data, bind: "score", tooltipContent: function(){ return this.month + ': ' + this.score; } }); }); }); </script> |
Markup |
Copy Code |
---|---|
<table> <tr> <td>Scores this year were all over the place:</td> <td><div id="wijsparkline" style="height:20px;width:100px" /></td> </tr> </table> |