Beispiel #1
0
        public bool Create(Chart entity)
        {
            bool result = true;
            var  chart  = _chartBuilder.Build(_queryViewFinder.FindEntityDefaultView(entity.EntityId), entity);

            //依赖于字段
            _dependencyService.Create(ChartDefaults.ModuleName, entity.ChartId, AttributeDefaults.ModuleName, chart.Attributes.Select(x => x.AttributeId).ToArray());
            return(result);
        }
Beispiel #2
0
        public IActionResult RenderChart([FromBody] RenderChartModel model)
        {
            QueryView.Domain.QueryView view = null;
            if (model.QueryId.Equals(Guid.Empty) && model.EntityName.IsNotEmpty())
            {
                view = _queryViewFinder.FindEntityDefaultView(model.EntityName);
                if (view != null)
                {
                    model.QueryId = view.QueryViewId;
                }
            }
            else if (!model.QueryId.Equals(Guid.Empty))
            {
                view = _queryViewFinder.FindById(model.QueryId);
            }
            if (view == null)
            {
                return(NotFound());
            }
            var chartEntity = _chartFinder.FindById(model.ChartId);
            var result      = _chartBuilder.Build(view, chartEntity, model.Filter, model.Groups.NotEmpty() ? model.Groups.Last() : string.Empty);

            model.Chart       = result.Chart;
            model.ChartData   = result.ChartData;
            model.ChartEntity = chartEntity;
            model.Attributes  = result.Attributes;
            model.DataSource  = result.DataSource;

            return(View($"~/Views/Component/{WebContext.ActionName}.cshtml", model));
        }
Beispiel #3
0
        public static void Run(IRunner caller, IProfiler profiler, int repetitionsCount, IChartBuilder builder)
        {
            var result = profiler.Measure(caller, repetitionsCount);
            var chart  = builder.Build(result);
            var form   = new Form {
                ClientSize = new Size(800, 600)
            };

            chart.Dock = DockStyle.Fill;
            form.Controls.Add(chart);
            Application.Run(form);
        }