Changeset 11196 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code
- Timestamp:
- 07/16/14 15:00:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml
r11084 r11196 36 36 } 37 37 38 @helper LineChartTime(string destinationTag, string url, string title = "", double? minY = null, double? maxY = null, string axisYFormat = null) 39 { 40 <script> 41 var @(destinationTag)Plot = $.jqplot("@destinationTag", "@url", { 42 title: "@title", 43 highlighter: { 44 show: true, 45 sizeAdjust: 7.5 46 }, 47 seriesDefaults: { 48 markerOptions: { show: false } 49 }, 50 dataRenderer: ajaxDataRenderer, 51 axes: { 52 xaxis: { 53 renderer: $.jqplot.DateAxisRenderer, 54 pad: 0 55 }, 56 yaxis: { 57 @if (axisYFormat != null) 58 {<text> 59 tickOptions: { 60 formatString: "@axisYFormat", 61 }, 62 </text>} 63 autoscale: true, 64 pad: 0, 65 @if (minY != null) 66 { 67 @:min: @minY, 68 } 69 @if (maxY != null) 70 { 71 @:max: @maxY, 72 } 73 }, 74 }, 75 gridPadding: { left: 50, right: 10 }, 76 cursor: { 77 show: true, 78 showTooltip: false, 79 zoom: true, 80 clickReset: false, 81 dblClickReset: false, 82 constrainZoomTo: 'x' 83 } 84 }); 38 @helper LineChartTime(string destinationTag, string url, string title = "", double? minY = null, double? maxY = null, string axisYFormat = null) { 39 <script> 40 var @(destinationTag)Plot = $.jqplot("@destinationTag", "@url", { 41 title: "@title", 42 highlighter: { 43 show: true, 44 sizeAdjust: 7.5 45 }, 46 seriesDefaults: { 47 markerOptions: { show: false } 48 }, 49 dataRenderer: ajaxDataRenderer, 50 axes: { 51 xaxis: { 52 renderer: $.jqplot.DateAxisRenderer, 53 pad: 0 54 }, 55 yaxis: { 56 @if (axisYFormat != null) 57 {<text> 58 tickOptions: { 59 formatString: "@axisYFormat", 60 }, 61 </text>} 62 autoscale: true, 63 pad: 0, 64 @if (minY != null) 65 { 66 @:min: @minY, 67 } 68 @if (maxY != null) 69 { 70 @:max: @maxY, 71 } 72 }, 73 }, 74 gridPadding: { left: 50, right: 10 }, 75 cursor: { 76 show: true, 77 showTooltip: false, 78 zoom: true, 79 clickReset: false, 80 dblClickReset: false, 81 constrainZoomTo: 'x' 82 } 83 }); 85 84 86 $(window).resize(function() { 87 @(destinationTag)Plot.replot({ resetAxes: true }); 88 }); 89 </script> 90 } 91 92 @helper RefreshChart(string destinationTag, string url, string startDate, string endDate) 93 { 85 $(window).resize(function() { 86 @(destinationTag)Plot.replot({ resetAxes: true }); 87 }); 88 </script> 89 } 90 91 @helper RefreshChart(string destinationTag, string url, string startDate, string endDate, double? minY=null, double? maxY=null) { 94 92 <text> 95 93 $.ajax({url: "@(new HtmlString(url))?start=" + @startDate + "&end=" + @endDate, datatype: "json", success: function(result) { … … 97 95 @(destinationTag)Plot.series[i].data = result[i]; 98 96 } 99 @(destinationTag)Plot.replot({ resetAxes: true }) 97 //Resets only the xaxis, still need to resize y with given min/max 98 @(destinationTag)Plot.replot({resetAxes:true}); 99 @if(minY != null) { 100 //If min Y was provided set the plot's min Y value 101 @:@(destinationTag)Plot.axes.yaxis.min = @minY; 102 } 103 @if(maxY != null) { 104 //If max Y was provided set the plot's max Y value 105 @:@(destinationTag)Plot.axes.yaxis.max = @maxY; 106 } 107 @(destinationTag)Plot.axes.yaxis.reset(); 108 //A final replot to redraw possible new Y axis values 109 @(destinationTag)Plot.replot({resetAxes:['xaxis']}); 110 @* @(destinationTag)Plot.replot({ resetAxes:true });*@ 100 111 }}); 101 112 </text>
Note: See TracChangeset
for help on using the changeset viewer.