Create a dynamic port
Set URL of the port using expression
/* set port address */
portDynamicSend(Microsoft.XLANGs.BaseTypes.Address) = msgDynamicAddress.DestinationURL;
/* set port type */
portDynamicSend(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-BasicHttp";
Modify the message using expression
msgSend2 = msgSend;
/* set web service operation name */
msgSend2(BTS.Operation)="Propose";
msgSend2(WCF.PropagateFaultMessage)= true;
/* if security is required, add the below lines */
msgSend2(WCF.SecurityMode)="Transport";
msgSend2(WCF.TransportClientCredentialType)="None";
20 December 2015
How to add legend to Chart.js graph
@model C2.Models.ChartModel
@{
ViewBag.Title = "Chart";
}
<h2>Chart</h2>
<div>
<h3>Data</h3>
@*@Html.Raw(Model.ChartHtmlDisplay)*@
</div>
<div style="width:50%">
<div>
<canvas id="canvas" height="450" width="600"></canvas>
</div>
<div id="divLegend">
</div>
</div>
<script>
var lineChartData = {
@Html.Raw(Model.ChartHtml)
};
window.onload = function(){
var options = {
legendTemplate : '<ul>'
+'<% for (var i=0; i<datasets.length; i++) { %>'
+'<li>'
+'<span style=\"color:<%= datasets[i].pointColor %>;font-family:Arial;font-size:1em\">'
+'<% if (datasets[i].label) { %><%= datasets[i].label %><% } %>'
+'</span>'
+'</li>'
+'<% } %>'
+'</ul>'
}
var ctx = document.getElementById("canvas").getContext("2d");
//don't forget to pass options in when creating new Chart
var lineChart = new Chart(ctx).Line(lineChartData, options);
//then you just need to generate the legend
var legend = lineChart.generateLegend();
//and append it to your page somewhere
$('#divLegend').html(legend);
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}
</script>
Subscribe to:
Posts (Atom)