Exemple #1
0
        public ActionResult Index()
        {
            RazorChartViewer viewer = ViewBag.Viewer = new RazorChartViewer(HttpContext, "chart1");

            // Draw chart using the most update data
            drawChart(viewer);

            // If is download request, output the chart as an attachment
            if (!string.IsNullOrEmpty(Request["download"]))
            {
                return(File(viewer.StreamChart(), Response.ContentType, "demo_" + DateTime.Now.ToString(
                                "yyyyMMddHHmmss") + "." + Request["download"]));
            }

            // If is streaming request, output the chart only
            if (RazorChartViewer.IsStreamRequest(Request))
            {
                return(File(viewer.StreamChart(), Response.ContentType));
            }

            return(View());
        }
Exemple #2
0
        public ActionResult Index()
        {
            RazorChartViewer viewer = ViewBag.Viewer = new RazorChartViewer(HttpContext, "chart1");

            DrawChart(viewer);

            if (RazorChartViewer.IsStreamRequest(Request))
            {
                return(File(viewer.StreamChart(), Response.ContentType));
            }

            return(View());
        }
        public ActionResult Index()
        {
            RazorChartViewer viewer = ViewBag.Viewer = new RazorChartViewer(HttpContext, "chart1");

            // Draw chart using the most update data
            drawChart(viewer);

            // If is streaming request, output the chart only
            if (RazorChartViewer.IsStreamRequest(Request))
            {
                return(File(viewer.StreamChart(), Response.ContentType));
            }

            return(View());
        }
Exemple #4
0
        public ActionResult Index()
        {
            RazorChartViewer     viewer       = ViewBag.Viewer = new RazorChartViewer(HttpContext, "chart1");
            RazorViewPortControl viewPortCtrl = ViewBag.ViewPortControl = new RazorViewPortControl(HttpContext, "chart2");

            //
            // This script handles both the full page request, as well as the subsequent partial updates
            // (AJAX chart updates). We need to determine the type of request first before we processing
            // it.
            //
            if (RazorChartViewer.IsPartialUpdateRequest(Request))
            {
                // Is a partial update request.
                drawChart(viewer);

                if (viewer.IsAttachmentRequest())
                {
                    return(File(viewer.StreamChart(), Response.ContentType, "demochart.pdf"));
                }
                else
                {
                    return(Content(viewer.PartialUpdateChart()));
                }
            }

            //
            // If the code reaches here, it is a full page request.
            //

            // Initialize the WebChartViewer and draw the chart.
            initViewer(viewer);
            drawChart(viewer);

            // Draw a thumbnail chart representing the full range in the WebViewPortControl
            drawFullChart(viewPortCtrl, viewer);
            return(View());
        }