Example #1
0
        public String GetChartDataAsJson(String fileName, char fileSeparator = ';', bool hasFileLabels = true)
        {
            var    chartService = new ChartService();
            string userName     = User.Identity.IsAuthenticated ? User.Identity.Name : "DefaultUser";

            return(chartService.ChartDataToJson(chartService.GetChartDataFromFile(userName, fileName, fileSeparator), hasFileLabels));
        }
Example #2
0
        public static void GenerateNodeIds()
        {
            CreateTestChart("GenerateNodeIdsChart");

            var chartService = new ChartService();

            var optionsGenerateNodeIds = new OptionsGenerateNodeIds
            {
                ChartId = "GenerateNodeIdsChart",
                Number  = 10
            };

            var resultGenerateNodeIds = chartService.GenerateNodeIds(optionsGenerateNodeIds);

            if (!resultGenerateNodeIds.IsSuccess)
            {
                Console.WriteLine(resultGenerateNodeIds.Error);
            }
            else
            {
                foreach (var id in resultGenerateNodeIds.Ids)
                {
                    Console.WriteLine(id);
                }
            }
        }
        async void Cmdr2Selected(KeyValuePair <bool, string> selected)
        {
            if (isLoading)
            {
                return;
            }

            Request.Interest = selected.Value;

            if (selected.Key == true)
            {
                if (_config == null)
                {
                    LoadData(Request, true);
                }
                else
                {
                    await LoadData(Request, false);

                    ChartService.AddChartDataSet(_config, Request, response);
                    chartComponent.Update();
                }
            }
            else
            {
                ChartService.RemoveChartDataSet(_config, Request, response);
                chartComponent.Update();
            }

            await onOptionsChanged.InvokeAsync(Request);
        }
Example #4
0
        public ActionResult Index()
        {
            var service       = new ChartService();
            var homeViewModel = User.Identity.IsAuthenticated ? service.GetChartsFileNames(User.Identity.Name) : new HomeViewModel();

            return(View(homeViewModel));
        }
Example #5
0
        public static void AddNodes()
        {
            var chartService   = new ChartService();
            var resultAddNodes = chartService.AddNodes(new OptionsAddNodes
            {
                ChartId = "AddNodesChartName",
                Nodes   = new List <Dictionary <string, string> >
                {
                    new Dictionary <string, string> {
                        { "id", "1" }, { "Name", "John Smith" }
                    },
                    new Dictionary <string, string> {
                        { "id", "2" }, { "pid", "1" }, { "Name", "Jack Daniels" }
                    },
                    new Dictionary <string, string> {
                        { "id", "3" }, { "pid", "1" }, { "Name", "Mickey Mouse" }, { "tags", "blue,assistant" }
                    },
                    new Dictionary <string, string> {
                        { "id", "4" }, { "pid", "1" }, { "Name", "Ana Garson" }, { "Photo", "https://cdn.balkan.app/shared/2.jpg" }, { "Country", "USA" }, { "City", "Las Vegas" }, { "JobTitle", "IT Manager" }, { "Email", "*****@*****.**" }
                    }
                }
            });

            if (!resultAddNodes.IsSuccess)
            {
                Console.WriteLine(resultAddNodes.Error);
            }
        }
        private void InitializeChart()
        {
            serviceTemplate.Name = nameService;
            List <Models.RequestReceived> requestRequest   = requestsReceived.FindAll(Request => Request.requestStatus == 1);
            List <Models.RequestReceived> requestAccepted  = requestsReceived.FindAll(Request => Request.requestStatus == 2);
            List <Models.RequestReceived> requestRejected  = requestsReceived.FindAll(Request => Request.requestStatus == 3);
            List <Models.RequestReceived> requestCancelled = requestsReceived.FindAll(Request => Request.requestStatus == 4);
            List <Models.RequestReceived> requestFinished  = requestsReceived.FindAll(Request => Request.requestStatus == 5);

            serviceTemplate.NumRequest   = requestRequest.Count;
            serviceTemplate.NumAccepted  = requestAccepted.Count;
            serviceTemplate.NumRejected  = requestRejected.Count;
            serviceTemplate.NumCancelled = requestCancelled.Count;
            serviceTemplate.NumFinished  = requestFinished.Count;
            System.Windows.Forms.DataVisualization.Charting.Chart chart = this.FindName("ChartService") as System.Windows.Forms.DataVisualization.Charting.Chart;

            Dictionary <string, int> value = new Dictionary <string, int>();

            value.Add("Solicitadas", serviceTemplate.NumRequest);
            value.Add("Aceptadas", serviceTemplate.NumAccepted);
            value.Add("Rechazadas", serviceTemplate.NumRejected);
            value.Add("Canceladas", serviceTemplate.NumCancelled);
            value.Add("Finalizadas", serviceTemplate.NumFinished);
            chart.DataSource = value;
            chart.Series["series"].XValueMember  = "Key";
            chart.Series["series"].YValueMembers = "Value";
            host.Child = chart;
            ChartService.Refresh();
        }
Example #7
0
        private void PopulateLineChart(Guid languageID, List <Guid> listOfRecordIds)
        {
            //var recordInYears = ChartService.GetRecordInYear(languageID, region,country,  sector,  document,  year, period,  last_Update,  counterpart,  DocCheckboxData,  thematicCheckboxData,  designProcessCheckboxData);

            var recordInYears = ChartService.GetRecordInYear(languageID, listOfRecordIds);

            List <int> category = new List <int>();

            foreach (var recordInYear in recordInYears)
            {
                category.Add(Convert.ToInt32(recordInYear.Value));
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string jsonDataCatefory         = serializer.Serialize(category);

            this.LineChartCategory = jsonDataCatefory;


            List <int> data = new List <int>();

            foreach (var recordInYear in recordInYears)
            {
                data.Add(Convert.ToInt32(recordInYear.RecordCount));
            }

            JavaScriptSerializer serializerData = new JavaScriptSerializer();
            string jsonData = serializerData.Serialize(data);

            this.LineChartItems = jsonData;
        }
Example #8
0
        /// <summary>
        /// home page load pie chart
        /// </summary>
        private void PopulatePieChart()
        {
            Guid documentTypeVariableID = new Guid(AppSettingsUtility.GetString(AppSettingsKeys.DocumentTypeVariableID));

            var cacheProvider = CacheFactory.Get();

            if (!cacheProvider.Exists(CacheKeys.CACHE_HOME_PIE_CHART))
            {
                List <PieChartModel> pieChartData = new List <PieChartModel>();
                var regionLanguages = ChartService.GetRecordsInRegion(TSMContext.CurrentSiteLanguageID);

                foreach (var regionLanguage in regionLanguages)
                {
                    pieChartData.Add(new PieChartModel {
                        name = regionLanguage.Name, y = regionLanguage.RecordCount
                    });
                }

                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string jsonData = serializer.Serialize(pieChartData);

                this.PieChartItems = jsonData;

                //Add in cache
                cacheProvider.Add <string>(this.PieChartItems, CacheKeys.CACHE_HOME_PIE_CHART, SiteConstants.CacheDuration);
            }
            else
            {
                this.PieChartItems = cacheProvider.Get <string>(CacheKeys.CACHE_HOME_PIE_CHART);
            }
        }
 public ChartController(
     ChartService chartService,
     ILogger <ChartController> logger)
 {
     _logger       = logger;
     _chartService = chartService;
 }
        public async Task GetLiveWeeksFor_WithRecentlyRegisteredUser_ShouldCallLastFmCorrectly()
        {
            // Arrange
            var context          = FakeThreeChartsContext.BuildInMemoryContext();
            var repo             = new ChartRepository(context);
            var lastFmMock       = new FakeLastFmService();
            var chartDateService = new ChartDateService(context);
            var service          = new ChartService(repo, chartDateService, lastFmMock.Object);

            var userRegisterDate = new DateTime(2020, 4, 21);
            var endDate          = new DateTime(2020, 4, 23, 23, 59, 59);
            var now = new DateTime(2020, 4, 22);

            var user = new User
            {
                UserName     = "******",
                IanaTimezone = "America/Sao_Paulo",
                RegisteredAt = userRegisterDate,
            };

            await context.Users.AddAsync(user);

            await context.SaveChangesAsync();

            // Act
            await service.GetLiveWeekFor(user, now);

            // Assert
            lastFmMock.Fake
            .Verify(lfm => lfm.GetWeeklyTrackChart(
                        It.Is <string>(s => s == "edxds"),
                        It.Is <long>(l => l == new DateTimeOffset(userRegisterDate).ToUnixTimeSeconds()),
                        It.Is <long>(l => l == new DateTimeOffset(endDate).ToUnixTimeSeconds()),
                        It.IsAny <CancellationToken?>()));
        }
        public async Task Execution_Chart_Report_In_Mongo_Test()
        {
            if (!_context.AllowMongoDB)
            {
                Assert.True(true);
                return;
            }

            // Arrange
            var optionsMock = Mock.Of <IOptionsMonitor <MongoOptions> >(_ => _.CurrentValue == _context.MongoOptions);
            Mock <IDatabaseServiceProvider> mockDatabaseServiceProvider = new Mock <IDatabaseServiceProvider>();

            mockDatabaseServiceProvider
            .Setup(a => a.GetOneDatabaseConnectionAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(_context.MongoDatabaseConenction));
            List <IExecutionChartReport> executionCharts = new List <IExecutionChartReport>()
            {
                new MongoExecutionChartReport(new MongoQueryExecution(optionsMock))
            };
            ChartService chartService = new ChartService(mockDatabaseServiceProvider.Object, null, executionCharts);

            // Act
            LetPortal.Portal.Models.Charts.ExecutionChartResponseModel result = await chartService.Execute(new LetPortal.Portal.Entities.Components.Chart
            {
                DatabaseOptions = new LetPortal.Portal.Entities.Shared.SharedDatabaseOptions
                {
                    Query = "{\r\n  \"$query\":{\r\n    \"apps\":[]\r\n  }\r\n}"
                },
                Definitions = new LetPortal.Portal.Entities.Components.ChartDefinitions
                {
                    ChartTitle        = "aaa",
                    ChartType         = LetPortal.Portal.Entities.Components.ChartType.VerticalBarChart,
                    MappingProjection = "name=name;value=createdDate;group=name"
                }
            }, new LetPortal.Portal.Models.Charts.ExecutionChartRequestModel
            {
                ChartId           = "asdas",
                ChartFilterValues = new List <LetPortal.Portal.Models.Charts.ChartFilterValue>
                {
                    new LetPortal.Portal.Models.Charts.ChartFilterValue
                    {
                        FilterType = LetPortal.Portal.Entities.Components.FilterType.NumberPicker,
                        Name       = "timeSpan",
                        IsMultiple = true,
                        Value      = "['1000-837076877586810630','10000-737076877586810630']"
                    },
                    new LetPortal.Portal.Models.Charts.ChartFilterValue
                    {
                        FilterType = LetPortal.Portal.Entities.Components.FilterType.DatePicker,
                        Name       = "createdDate",
                        IsMultiple = true,
                        Value      = string.Format("['{0}','{1}']", DateTime.UtcNow.AddDays(-1).ToString("o"), DateTime.UtcNow.AddDays(1).ToString("o"))
                    }
                }
            });

            // Assert
            Assert.NotEmpty(result.Result);
        }
Example #12
0
 public IHttpActionResult GetStockChartValues(int gameId, int turn)
 {
     using (ChartService chartService = new ChartService())
     {
         var result = chartService.GetStocksChartValues(gameId, turn);
         return(Json(result));
     }
 }
        public IActionResult OnGet(string isbn)
        {
            Book book = repo.GetBook(isbn);

            ChartService.Add(book);
            OrderedBooks = ChartService.GetOrderedBooks();
            return(Page());
        }
Example #14
0
        /// <summary>
        /// Paints an annotation object using the specified graphics.
        /// </summary>
        /// <param name="graphics">
        /// A <see cref="ChartGraphics"/> object, used to paint the annotation object.
        /// </param>
        /// <param name="chart">
        /// Reference to the <see cref="ChartService"/> control.
        /// </param>
        override internal void Paint(ChartService chart, ChartGraphics graphics)
        {
            // Paint all annotations in the group
            foreach (Annotation annotation in annotations)
            {
                annotation.Paint(chart, graphics);
            }

            if ((Common.ProcessModePaint && IsSelected) ||
                Common.ProcessModeRegions)
            {
                // Get annotation position in relative coordinates
                GetRelativePosition(out SKPoint firstPoint, out SKSize size, out _);
                SKPoint secondPoint = new(firstPoint.X + size.Width, firstPoint.Y + size.Height);

                // Create selection rectangle
                SKRect selectionRect = new(firstPoint.X, firstPoint.Y, secondPoint.X, secondPoint.Y);

                // Check rectangle orientation
                if (selectionRect.Width < 0)
                {
                    selectionRect.Left  = selectionRect.Right;
                    selectionRect.Right = -selectionRect.Width;
                }
                if (selectionRect.Height < 0)
                {
                    selectionRect.Top    = selectionRect.Bottom;
                    selectionRect.Bottom = -selectionRect.Height;
                }

                // Check if text position is valid
                if (selectionRect.IsEmpty ||
                    float.IsNaN(selectionRect.Left) ||
                    float.IsNaN(selectionRect.Top) ||
                    float.IsNaN(selectionRect.Right) ||
                    float.IsNaN(selectionRect.Bottom))
                {
                    return;
                }

                if (Common.ProcessModeRegions)
                {
                    // Add hot region
                    Common.HotRegionsList.AddHotRegion(
                        selectionRect,
                        ReplaceKeywords(ToolTip),
                        String.Empty,
                        String.Empty,
                        String.Empty,
                        this,
                        ChartElementType.Annotation,
                        String.Empty);
                }

                // Paint selection handles
                PaintSelectionHandles(graphics, selectionRect, null);
            }
        }
Example #15
0
 protected override async Task OnAfterRenderAsync(bool firstRender)
 {
     if (TimecardCharts != null)
     {
         foreach (var chart in TimecardCharts)
         {
             await ChartService.RenderChart(chart.ChartId, chart, true);
         }
     }
 }
Example #16
0
        public MainForm()
        {
            InitializeComponent();

            _loader         = new CsvLoader();
            _graphicService = new GraphicService();
            _state          = new State();
            _chartService   = new ChartService(main_chart, _state);
            _tradeProcess   = new TradeProcess(listBox_Orders, label_BuyResult, _state);
        }
Example #17
0
        public static void CreateTestChart(string chartId)
        {
            var chartService = new ChartService();

            chartService.Create(new OptionsCreateNewChart
            {
                ChartId      = chartId,
                TemplateName = "Berlin"
            });
        }
Example #18
0
        public static void CreateUpdateRemoveList()
        {
            var chartService          = new ChartService();
            var optionsCreateNewChart = new OptionsCreateNewChart
            {
                ChartId      = "CreateUpdateRemoveListChart",
                TemplateName = "Berlin"
            };
            var resultChart = chartService.Create(optionsCreateNewChart);

            if (!resultChart.IsSuccess)
            {
                Console.WriteLine(resultChart.Error);
            }

            var optionsUpdateChart = new OptionsUpdateChart
            {
                NewChartId      = "CreateUpdateRemoveListChartNewUpdated",
                NewTemplateName = "London",
                OldChartId      = "CreateUpdateRemoveListChart"
            };

            resultChart = chartService.Update(optionsUpdateChart);
            if (!resultChart.IsSuccess)
            {
                Console.WriteLine(resultChart.Error);
            }

            var optionsList = new OptionsList
            {
                Skip = 0,
                Take = 10,
                WildcardSearchPattern = "*NewUpdated*"
            };

            var resultList = chartService.ListDescriptors(optionsList);


            if (!resultList.IsSuccess)
            {
                Console.WriteLine(resultList.Error);
            }

            var optionsChart = new OptionsChart
            {
                ChartId = "CreateUpdateRemoveListChartNewUpdated"
            };

            var resultRemove = chartService.Remove(optionsChart);

            if (!resultRemove.IsSuccess)
            {
                Console.WriteLine(resultRemove.Error);
            }
        }
Example #19
0
 public CommonElements(ChartService chart)
 {
     _chart                 = chart;
     DataManager            = new DataManager(this);
     CustomPropertyRegistry = new CustomPropertyRegistry();
     ImageLoader            = new ImageLoader(this);
     ChartTypeRegistry      = new ChartTypeRegistry();
     BorderTypeRegistry     = new BorderTypeRegistry();
     FormulaRegistry        = new FormulaRegistry();
     HotRegionsList         = new(this);
 }
Example #20
0
        /// <summary>
        /// Paints an annotation object on the specified graphics.
        /// </summary>
        /// <param name="graphics">
        /// A <see cref="ChartGraphics"/> object, used to paint an annotation object.
        /// </param>
        /// <param name="chart">
        /// Reference to the <see cref="ChartService"/> control.
        /// </param>
        override internal void Paint(ChartService chart, ChartGraphics graphics)
        {
            // Get annotation position in relative coordinates
            GetRelativePosition(out SKPoint firstPoint, out _, out _);
            SKPoint secondPoint = new(firstPoint.X + SKSize.Empty.Width, firstPoint.Y + SKSize.Empty.Height);

            // Create selection rectangle
            SKRect selectionRect = new(firstPoint.X, firstPoint.Y, secondPoint.X, secondPoint.Y);

            // Get text position
            SKRect rectanglePosition = new(selectionRect.Left, selectionRect.Top, selectionRect.Right, selectionRect.Bottom);

            if (rectanglePosition.Width < 0 || rectanglePosition.Height < 0)
            {
                rectanglePosition = rectanglePosition.Standardized;
            }

            // Check if position is valid
            if (float.IsNaN(rectanglePosition.Left) ||
                float.IsNaN(rectanglePosition.Top) ||
                float.IsNaN(rectanglePosition.Right) ||
                float.IsNaN(rectanglePosition.Bottom))
            {
                return;
            }

            if (isRectVisible &&
                Common.ProcessModePaint)
            {
                // Draw rectangle
                graphics.FillRectangleRel(
                    rectanglePosition,
                    BackColor,
                    BackHatchStyle,
                    String.Empty,
                    ChartImageWrapMode.Scaled,
                    SKColor.Empty,
                    ChartImageAlignmentStyle.Center,
                    BackGradientStyle,
                    BackSecondaryColor,
                    LineColor,
                    LineWidth,
                    LineDashStyle,
                    ShadowColor,
                    ShadowOffset,
                    PenAlignment.Center,
                    isEllipse,
                    1,
                    false);
            }

            // Call base class to paint text, selection handles and process hot regions
            base.Paint(chart, graphics);
        }
Example #21
0
        /// <summary>
        /// Paints the annotation object on the specified graphics.
        /// </summary>
        /// <param name="graphics">
        /// A <see cref="ChartGraphics"/>
        /// </param>
        /// <param name="chart">
        /// Reference to the <see cref="ChartService"/> control that owns the annotation.
        /// </param>
        override internal void Paint(ChartService chart, ChartGraphics graphics)
        {
            // Get annotation position in relative coordinates
            GetRelativePosition(out SKPoint firstPoint, out SKSize size, out _);
            SKPoint secondPoint = new(firstPoint.X + size.Width, firstPoint.Y + size.Height);

            // Create selection rectangle
            SKRect selectionRect = new(firstPoint.X, firstPoint.Y, secondPoint.X, secondPoint.Y);

            // Get text position
            SKRect rectanglePosition = new(selectionRect.Left, selectionRect.Top, selectionRect.Right, selectionRect.Bottom);

            if (rectanglePosition.Width < 0 || rectanglePosition.Height < 0)
            {
                rectanglePosition = rectanglePosition.Standardized;
            }

            // Check if position is valid
            if (float.IsNaN(rectanglePosition.Left) ||
                float.IsNaN(rectanglePosition.Top) ||
                float.IsNaN(rectanglePosition.Right) ||
                float.IsNaN(rectanglePosition.Bottom))
            {
                return;
            }

            if (Common.ProcessModePaint)
            {
                // Do not draw border if size is less that 10 pixels
                SKRect absRectanglePosition = graphics.GetAbsoluteRectangle(rectanglePosition);
                if (absRectanglePosition.Width > 30f &&
                    absRectanglePosition.Height > 30f)
                {
                    // Draw rectangle
                    graphics.Draw3DBorderRel(
                        _borderSkin,
                        rectanglePosition,
                        BackColor,
                        BackHatchStyle,
                        String.Empty,
                        ChartImageWrapMode.Scaled,
                        SKColor.Empty,
                        ChartImageAlignmentStyle.Center,
                        BackGradientStyle,
                        BackSecondaryColor,
                        LineColor,
                        LineWidth,
                        LineDashStyle);
                }
            }

            // Call base class to paint text, selection handles and process hot regions
            base.Paint(chart, graphics);
        }
Example #22
0
        private void InitializeCharts()
        {
            var activityGroupsByType = UserActivities.GroupBy(a => a.Type);
            Dictionary <string, int>   activityTypesWithCount     = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Count());
            Dictionary <string, float> activityTypesWithDistances = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Sum(a => a.Distance));
            Dictionary <string, float> activityTypesWithDuration  = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Sum(a => a.MovingTime));

            _distanceChartConfig = ChartService.DrawPieChart("Overall distance by type", new SortedDictionary <string, float>(activityTypesWithDistances));
            _countChartConfig    = ChartService.DrawPieChart("Activity count by type", new SortedDictionary <string, int>(activityTypesWithCount));
            _durationChartConfig = ChartService.DrawPieChart("Overall duration by type", new SortedDictionary <string, float>(activityTypesWithDuration));
        }
Example #23
0
        public async Task LoadData(DsRequest Request, bool resetChart = true)
        {
            await semaphoreSlim.WaitAsync();

            try
            {
                if (isLoading == false)
                {
                    isLoading = true;
                    await InvokeAsync(() => StateHasChanged());
                }
                response = await dataService.LoadData(Request);

                if (response != null)
                {
                    Request.Responses.Add(response);
                    isDataAvailable = true;
                    if (resetChart)
                    {
                        SetChartData();
                        if (Request.doReloadSelected && Request.CmdrsSelected != null)
                        {
                            var cmdrsSelected = Request.CmdrsSelected.Where(x => x.Selected && x.Name != Request.Interest);
                            if (cmdrsSelected.Any())
                            {
                                foreach (var cmdr in cmdrsSelected)
                                {
                                    var cmdrrequest  = new DsRequest(Request.Mode, Request.Timespan, Request.Player, cmdr.Name);
                                    var cmdrresponse = await dataService.LoadData(cmdrrequest);

                                    ChartService.AddChartDataSet(_config, cmdrrequest, cmdrresponse);
                                    chartComponent.Update();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Info = "Failed loading data :(";
                }
            }
            catch (Exception e)
            {
                logger.LogError($"failed loading data: {e.Message}");
            }
            finally
            {
                semaphoreSlim.Release();
            }
            isLoading = false;
            await InvokeAsync(() => StateHasChanged());
        }
 public ChartWizardAdapter(ChartService chartservice)
 {
     _chartservice = chartservice;
     _chartwizard  = new ChartWizard();
     _chartwizard.SchemaChanging       += new SchemaChangingHandler(_chartwizard_SchemaChanging);
     _chartwizard.SchemaCompleted      += new SchemaCompletedHander(_chartwizard_SchemaCompleted);
     _chartwizard.SchemaCaptionChanged += new SchemaCaptionChangedHandler(_chartwizard_SchemaCaptionChanged);
     _chartwizard.AddingSchema         += new AddingSchamaHandler(_chartwizard_AddingSchema);
     _chartwizard.DeletingSchema       += new DeletingSchemaHandler(_chartwizard_DeletingSchema);
     _chartwizard.DefaultSchema        += new DefaultSchemaHandler(_chartwizard_DefaultSchema);
     _chartwizard.CopySchema           += new CopySchamaHandler(_chartwizard_CopySchema);
 }
        public void OpenChartWizard(Chart chart)
        {
            ChartService _chartservice = null;
            string       id            = null;

            if (chart.Report.Type == ReportType.IndicatorReport)
            {
                id = "IndicatorChart";
                Hashtable       ctn = new Hashtable();
                SimpleHashtable sht = new SimpleHashtable();
                if (!string.IsNullOrEmpty(chart.DataSource))
                {
                    Section          indicatordetail = chart.Report.Sections[SectionType.IndicatorDetail];
                    IIndicatorMetrix metrix          = indicatordetail.Cells[chart.DataSource] as IIndicatorMetrix;
                    if (metrix == null)
                    {
                        throw new Exception("非法图表数据源矩阵");
                    }

                    sht.Add("__bcross__", metrix.CrossPart != null);
                    if (metrix.IndicatorParts != null)
                    {
                        foreach (IPart indi in metrix.IndicatorParts)
                        {
                            sht.Add((indi as Cell).Caption, (indi as Cell).Name);
                        }
                    }
                }
                else
                {
                    sht.Add("__bcross__", false);
                }
                ctn.Add(chart.Level, sht);
                _chartservice = new IndicatorChartService(chart.Report, ctn);
            }
            else
            {
                _chartservice = new ChartService(chart.Report);
            }

            ChartWizardAdapter _wizardadapter = new ChartWizardAdapter(_chartservice);

            if (_wizardadapter.ChartWizard.ShowDialog(_chartservice.GetSchemasAllLevel(chart.Level), chart.Level, id) == DialogResult.OK)
            {
                RemoteDataHelper rdh = DefaultConfigs.GetRemoteHelper();
                rdh.SaveChartStrings(ClientReportContext.Login.UfMetaCnnString, chart.Report.ViewID, chart.Report.ChartStrings);
            }
            else
            {
                chart.Report.ChartStrings = null;
            }
            chart.ChartWizard = null;
        }
Example #26
0
        public async Task ShouldDoBasicCalculationScenario3()
        {
            var svc   = new ChartService();
            var chart = await svc.ProcessNatalChart(new DateTime(1980, 12, 22, 15, 00, 00), -23.5489, -46.6388);

            Assert.True(
                chart.Aspects[0].Planet.Name.ToString() == "SUN" &&
                chart.Aspects[0].Sign.Name == Domain.Enums.Sign.Name.CAPRICORN &&
                chart.Aspects[4].Planet.Name.ToString() == "MARS" &&
                chart.Aspects[4].Sign.Name == Domain.Enums.Sign.Name.CAPRICORN &&
                chart.Aspects[9].Planet.Name.ToString() == "PLUTO" &&
                chart.Aspects[9].Sign.Name == Domain.Enums.Sign.Name.LIBRA);
        }
Example #27
0
        public async Task ShouldDoBasicCalculationScenario2()
        {
            var svc   = new ChartService();
            var chart = await svc.ProcessNatalChart(new DateTime(1989, 07, 07, 17, 30, 00), -23.5489, -46.6388);

            Assert.True(
                chart.Aspects[0].Planet.Name.ToString() == "SUN" &&
                chart.Aspects[0].Sign.Name == Domain.Enums.Sign.Name.CANCER &&
                chart.Aspects[4].Planet.Name.ToString() == "MARS" &&
                chart.Aspects[4].Sign.Name == Domain.Enums.Sign.Name.LEO &&
                chart.Aspects[9].Planet.Name.ToString() == "PLUTO" &&
                chart.Aspects[9].Sign.Name == Domain.Enums.Sign.Name.SCORPIO);
        }
        /// <summary>
        /// Remove any changes done while preparing ThreeLineBreak chart type for rendering.
        /// </summary>
        /// <param name="series">Series to be un-prepared.</param>
        /// <returns>True if series was removed from collection.</returns>
        internal static bool UnPrepareData(Series series)
        {
            if (series.Name.StartsWith("THREELINEBREAK_ORIGINAL_DATA_", StringComparison.Ordinal))
            {
                // Get reference to the chart control
                ChartService chart = series.Chart;
                if (chart == null)
                {
                    throw (new InvalidOperationException(SR.ExceptionThreeLineBreakNullReference));
                }

                // Get original ThreeLineBreak series
                Series threeLineBreakSeries = chart.Series[series.Name[29..]];
Example #29
0
        /// <summary>
        /// Remove any changes done while preparing Kagi chart type for rendering.
        /// </summary>
        /// <param name="series">Series to be un-prepared.</param>
        /// <returns>True if series was removed from collection.</returns>
        internal static bool UnPrepareData(Series series)
        {
            if (series.Name.StartsWith("KAGI_ORIGINAL_DATA_", StringComparison.Ordinal))
            {
                // Get reference to the chart control
                ChartService chart = series.Chart;
                if (chart == null)
                {
                    throw (new InvalidOperationException(SR.ExceptionKagiNullReference));
                }

                // Get original Kagi series
                Series kagiSeries = chart.Series[series.Name[19..]];
Example #30
0
        //member methods
        public async void ChangeChartRecord(object sender, RecordChangeEventArgs args)
        {
            if (args.NewChart != null)
            {
                chartToUpdate = await ChartService.GetChart(args.NewChart.ChartId);

                chartToUpdate.ChartOptions = args.NewChart.ChartOptions;
                await InvokeAsync(() =>
                {
                    ChartService.UpdateChart(chartToUpdate.ChartId, chartToUpdate.ChartOptions);
                });
            }
        }