As i have to develop a list on issue.
the list contain ticket status,ticket priority and ticket count.
when i developed that legend gets on going when ever i add any item in that list.
how to restrict it.
<script type="text/javascript" src="http://dskptmof06:8080/SiteAssets/jquery.js"></script>
<script type="text/javascript" src="http://dskptmof06:8080/SiteAssets/highcharts.js"></script>
<script type="text/javascript">
var splistitems;
var seriesarray = new Array();
ExecuteOrDelayUntilScriptLoaded(GetChartData, "sp.js");
function GetChartData() {
seriesarray = [];
var currentcontext = new SP.ClientContext.get_current();
var splist = currentcontext.get_web().get_lists().getByTitle('ScmsTicket');
var splistquery = new SP.CamlQuery();
splistitems = splist.getItems(splistquery);
currentcontext.load(splistitems);
currentcontext.executeQueryAsync(Function.createDelegate(this, GetChartDataSuccess), Function.createDelegate(this, GetChartDataFail));
}
function GetChartDataSuccess(sender, args) {
var splistitemcount = splistitems.get_count();
if (splistitemcount != 0) {
var splistitemenumerator = splistitems.getEnumerator();
while (splistitemenumerator.moveNext()) {
var currentlistitem = splistitemenumerator.get_current();
var itemname = currentlistitem.get_item("Title");
var itemTicket_Status = currentlistitem.get_item("Ticket_Status");
var itemTicket_Priority = currentlistitem.get_item("Ticket_Priority");
var itemTicket_count = currentlistitem.get_item("Ticket_count");
var seriesitem = {
name: itemTicket_Status,
data: [itemTicket_count]
};
seriesarray.push(seriesitem);
}
DrawChart();
}
}
function GetChartDataFail(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
function DrawChart() {
ScmsTicket = new Highcharts.Chart({
chart: {
renderTo: 'chart-container',
type: 'bar'
},
title: {
text: 'ScmsTicket'
},
xAxis: {
categories: ['Ticket_Status']
},
yAxis: {
min: 0,
title: {
text: 'ScmsTicket'
},
stackLabels: {
enabled: false,
style: {
fontWeight: 'bold',
color: 'gray'
}
}
},
legend: {
align: 'right',
x: -70,
verticalAlign: 'top',
y: 20,
floating: true,
backgroundColor: 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.series.name +': '+ this.y +'<br/>'+
'Total: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels:{
enabled: true,
color: 'white',
style: {
textShadow: '0 0 3px black, 0 0 3px black'
}
}
}
},
series: seriesarray
});
}
</script>
<div id="chart-container">ScmsTicket.</div>
plz help me with appropriate program