Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2260
How to define igDataChart series tooltipTemplate to reference the valueMemberPath generically.
posted

I have 2 series in my igDataChart. I would like to create a single template to support both but couldn't figure out how. I want the template to include the current series data point value. One of the series has "valueMemberPath: 'UNITS'". The other is "valueMemberPath: 'PEERS'". I had to create separate templates because I didn't know how to generically refer to the series value. I tried to replace "${item.UNITS}" and "${item.PEERS}" with ${series.valueMemberPath}, but that just put the name of valueMemberPath in the output, not the associated value. How can I combine what I want into a single template? 

These are my current templates:

<script id="seriesUnitTemplate" type="text/x-jquery-tmpl">
<div>
<span style="font-size: larger">${series.title}</span><br />
<span style="font-size: larger; color: ${actualSeriesBrush}">${item.UNITS}%</span><br />
<hr style="border-top: 1px solid lightgray !important; height: 1px !important; margin-top: 0px !important; margin-bottom: 0px !important" />
<span>${item.YEAR}</span><br />
</div>
</script>

<script id="seriesPeerTemplate" type="text/x-jquery-tmpl">
<div>
<span style="font-size: larger">${series.title}</span><br />
<span style="font-size: larger; color: ${actualSeriesBrush}">${item.PEERS}%</span><br />
<hr style="border-top: 1px solid lightgray !important; height: 1px !important; margin-top: 0px !important; margin-bottom: 0px !important" />
<span>${item.YEAR}</span><br />
</div>