Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @foreach (var iteration in Model)
- {
- <script type="text/javascript">
- window.onload = function() {
- var result1 = @Html.Raw(iteration.Line1);
- var dataPoints1 = [];
- for (var i = 0; i < result1.length; i++) {
- dataPoints1.push({ x: result1[i].x, y: result1[i].y });
- }
- var result2 = @Html.Raw(iteration.Line2);
- var dataPoints2 = [];
- for (var i = 0; i < result2.length; i++) {
- dataPoints2.push({ x: result2[i].x, y: result2[i].y });
- }
- var result3 = @Html.Raw(iteration.Line3);
- var dataPoints3 = [];
- for (var i = 0; i < result3.length; i++) {
- dataPoints3.push({ x: result3[i].x, y: result3[i].y });
- }
- // console.log("RESULRT " + result3.length);
- var chart = new CanvasJS.Chart("@($"chartContainer{iteration.Id}")",
- {
- theme: "theme2",
- animationEnabled: true,
- title: {
- text: "График"
- },
- subtitles: [
- { text: "Resize" }
- ],
- toolTip: {
- content:"y: {y}" ,
- },
- axisX: {
- labelAngle: -30
- },
- data: [
- {
- // change type to bar, line, area, pie, etc.
- type: "line", //потери
- lineDashType: "shortDashDot",
- name: "Потери",
- showInLegend: true,
- dataPoints: dataPoints1
- },
- {
- // change type to bar, line, area, pie, etc.
- type: "line", //подьем
- showInLegend: true,
- lineDashType: "dash",
- markerType: "square",
- name: "Подьем",
- dataPoints: dataPoints2
- }, {
- // change type to bar, line, area, pie, etc.
- type: "line", //прирост
- name: "Прирост",
- showInLegend: true,
- dataPoints: dataPoints3
- }
- ]
- });
- chart.render();
- };
- window.addEventListener('load', onload);
- </script>}
Add Comment
Please, Sign In to add comment