Using KendoUI Line graph, I have multiple series of data and I'd like to show in the tooltip additional data pertaining to a single series of data in the tool tip. In this case I want to show the survey count in the tooltip for each product. I also have a market segment that represents the average of all products in the database in which I don't want to show the data. So for Market Segment I don't want to show the Survey Count.
How do I go about doing this?
This link is to my failed jsFiddle Project: http://jsfiddle.net/rodneyhickman/uMTnh/9/
In the jsFiddle project above I get the survey count for the first product they way I want it for product 2, product 3, etc. For the Averages (Market Segment) I don't want to show a survey count.
My markup:
<div >
<div id='chart' ></div>
</div>
My JavaScript:
jQuery(function() {
var myData = [
{
"product1": 86.61,
"product2": 85.23,
"marketsegment": 80.17,
"date": "Mar 2011",
"surveyCountProduct1": "2",
"surveyCountProduct2": "4"
},
{
"product1": 87.61,
"product2": 84.23,
"marketsegment": 81.12,
"date": "Mar 2011",
"surveyCountProduct1": "2",
"surveyCountProduct2": "3"
},
{
"product1": 87.91,
"product2": 85.53,
"marketsegment": 81.57,
"date": "Mar 2011",
"surveyCountProduct1": "2",
"surveyCountProduct2": "4"
},
{
"product1": 88.22,
"product2": 85.23,
"marketsegment": 81.90,
"date": "Mar 2011",
"surveyCountProduct1": "2",
"surveyCountProduct2": "4"
},
{
"product1": 88.61,
"product2": 86.13,
"marketsegment": 79.17,
"date": "Mar 2011",
"surveyCountProduct1": "2",
"surveyCountProduct2": "5"
}
];
jQuery('#chart').kendoChart({
title: {
text: "Overall Score out of 100",
align: "left",
font: "18px Arial, Verdana, sans-serif",
color: "#444"
},
seriesDefaults: {
type: "line",
missingValues: "interpolate"
},
legend: {
position: "bottom"
},
tooltip: {
visible: true,
template: "<b>#= series.name #</b><br/>#= dataItem.date #<br/>#= value #<br/>Survey Count= #= dataItem.surveyCountProduct1 #"
},
valueAxis: {
min: 75,
max: 95,
plotBands: [{
from: 75,
to: 80,
color: "#f5f5f5"
},
{
from: 85,
to: 90,
color: "#f5f5f5"
},
{
from: 95,
to: 100,
color: "#f5f5f5"
}]
},
dataSource: {
data: myData
},
series: [
{
name: "Some Product 1",
color: "#004990",
width: 1,
field: "product1",
markers: {
background: "#004990"
}
},
{
name: "Some Product 2",
color: "#8a7967",
width: 1,
field: "product2",
markers: {
background: "#8a7967"
}
},
{
name: " Market Segment Average",
color: "#da7633",
width: 1,
field: "marketsegment",
markers: {
background: "#da7633"
}
}],
categoryAxis: {
labels: {
rotation: -45,
step: 1,
skip: 0
},
categories: ["Mar", "Apr", "May", "Jun", "Jul"]
}
});
});
Any help would be appreciated.
$(document).ready(
function () {
$("#click").click(function () {
var val = document.getElementById('textboxs').value;
var View = $("#listView").data("kendoListView");
View.add(val);
});
});
<
td style="width: 141px">
<ul id="listView" />
</td>
</tr>
<td>
<input type="text" id="textboxs" name="textname" />
<input type="button" id="click" value="Add" />
</td>
<ul class="kendo-tabstrip" runat="server" style="visibility:hidden"> <li class="k-state-active">First Tab</li> <li>Second Tab</li> <li>Third Tab</li></ul><div>Tab1</div><div>Tab2</div><div>Tab3</div>//Create the tab data for (var i = 0; i < subtabcontainer.length; i++) { tabdata[i] = { text: tabs[i].innerHTML, content: subtabcontainer[i].innerHTML }; } var tabstrip = $(this).kendoTabStrip({ dataTextField: "text", dataContentField: "content", dataSource: tabdata }).data("kendoTabStrip").select(1);
watts, hours and how to call the javascript function?
<div data-role="view" id="forms" data-title="Calculadora de Consumo" data-layout="layout" data-transition="slide" data-init="initForm" > <ul data-role="listview" data-style="inset" data-type="group"> <li> Sepa cuánto consumen sus artefactos. <ul> <li> <input type="tel" name="watts" size="5" value="0" />Watts del artefacto </li> <li> <input type="tel" name="hours" size="5" value="0" />Horas de funcionamiento </li> <li> <input type="tel" name="unitcost" size="9" value="105" />Costo KWh </li> <li> <input type="button" value="Calculate" onclick="workitout(this.form)" /> </li> <li> <input type="text" name="daycost" size="7" />Costo diario </li> <li> <input type="text" name="qtrcost" size="7" />Costo mensual </li> <li> <input type="text" name="yrcost" size="7" />Costo anual </li> </ul> </li> </ul></div><script language="JavaScript" type="text/JavaScript"><!--function workitout(form){var kw = form.watts.value / 1000;var hrs = parseInt(form.hours.value);var cost = (form.unitcost.value * kw * hrs) / 100;var annual = cost * 365;var quarter = annual / 12; cost = round(cost);annual = round(annual);annual = round(annual);form.daycost.value = cost;form.qtrcost.value = quarter;form.yrcost.value = annual;}function round (num) {num = Math.round(num * 100) / 100;num = (num + 0.001) + '';return num.substring(0, num.indexOf('.') + 3);} // End --></script>