private void CheckValueCount()
 {
     while (valuePanel.childCount != controller.SeriesCount)
     {
         if (valuePanel.childCount > controller.SeriesCount)
         {
             string     name = ChartUtils.NameGenerator(valueChildString, valuePanel.childCount - 1);
             GameObject obj  = valuePanel.Find(name).gameObject;
             if (obj)
             {
                 // Gameobject will not be destroyed until after Update()
                 // hence it must detach with parent before Destroy()
                 obj.transform.parent = null;
                 Destroy(obj);
             }
             else
             {
                 Debug.LogError(String.Format("{0} not found?!", name));
             }
         }
         else if (valuePanel.childCount < controller.SeriesCount)
         {
             GameObject obj = Instantiate(valueButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject;
             obj.name = ChartUtils.NameGenerator(valueChildString, valuePanel.childCount);
             obj.transform.SetParent(valuePanel);
             //obj.transform.localPosition = Vector3.zero;
         }
     }
 }
Exemplo n.º 2
0
        void Initialize()
        {
            this.dataProvider = DataSource.GetDataProvider();
            this.range        = this.currentRange = DateTimeUtils.GetOneYearRange();
            ucSales.Diagram.AxisY.Visibility         = Utils.DefaultBoolean.False;
            ucSales.Diagram.AxisX.Visibility         = Utils.DefaultBoolean.False;
            ucUnits.Diagram.AxisY.Visibility         = Utils.DefaultBoolean.False;
            ucUnits.Diagram.AxisX.Visibility         = Utils.DefaultBoolean.False;
            ucUnits.Diagram.Margins.All              = 0;
            ucUnits.Diagram.Rotated                  = true;
            ucUnits.chart.Legend.AlignmentVertical   = LegendAlignmentVertical.Top;
            ucUnits.chart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.RightOutside;

            ucUnits.chart.Legend.Border.Visibility    = Utils.DefaultBoolean.False;
            ucUnits.chart.Legend.Margins.Right        = 0;
            ucUnits.chart.Legend.MarkerSize           = new System.Drawing.Size(18, 18);
            ucUnits.chart.Legend.MarkerMode           = LegendMarkerMode.None;
            ucUnits.chart.Legend.TextOffset           = 8;
            ucUnits.chart.Legend.VerticalIndent       = 4;
            ucUnits.chart.Legend.Visibility           = Utils.DefaultBoolean.True;
            ucUnits.chart.Series[0].LegendTextPattern = "{A}";
            ucSales.Diagram.Margins.All = 0;

            Palette palette = ChartUtils.GeneratePalette();

            this.rangeControlClient           = new RangeControlSalesClient(palette[3].Color);
            this.rangeControlClient.YearMonth = true;
            rangeControl.Client = this.rangeControlClient;
            IEnumerable <SalesGroup> sales = dataProvider.GetSales(range.Start, range.End, GroupingPeriod.Day);

            this.rangeControlClient.UpdateData(sales);
        }
Exemplo n.º 3
0
        public void Test_BeatToSeconds_AfterLastBPMChange()
        {
            // 60BPM @ beat 60 = 60 seconds
            Assert.AreEqual(
                60,
                ChartUtils.BeatToSeconds(new BPM[] { new BPM(60, 0) }, 60)
                );

            // 120BPM @ beat 60 = 30 seconds
            Assert.AreEqual(
                30,
                ChartUtils.BeatToSeconds(new BPM[] { new BPM(120, 0) }, 60)
                );

            // 60BPM -> 120BPM @ beat 60 = 45 seconds
            Assert.AreEqual(
                45,
                ChartUtils.BeatToSeconds(
                    new BPM[]
            {
                new BPM(60, 0),
                new BPM(120, 30)
            },
                    60
                    )
                );
        }
Exemplo n.º 4
0
 /// <summary>
 /// For each series we need to attach a child to the chart object.
 /// </summary>
 private void CheckRendererCount()
 {
     while (chartHolder.childCount != controller.SeriesCount)
     {
         if (chartHolder.childCount > controller.SeriesCount)
         {
             string     name = ChartUtils.NameGenerator(chartChildString, chartHolder.childCount - 1);
             GameObject obj  = chartHolder.Find(name).gameObject;
             if (obj)
             {
                 // Gameobject will not be destroyed until after Update()
                 // hence it must detach with parent before Destroy()
                 obj.transform.parent = null;
                 Destroy(obj);
             }
             else
             {
                 Debug.LogError(String.Format("{0} not found?!", name));
             }
         }
         else if (chartHolder.childCount < controller.SeriesCount)
         {
             GameObject obj = new GameObject(ChartUtils.NameGenerator(chartChildString, chartHolder.childCount));
             obj.transform.SetParent(chartHolder.transform);
             obj.transform.localPosition = Vector3.zero;
             obj.AddComponent <CanvasRenderer>();
         }
     }
 }
Exemplo n.º 5
0
        private Decision GetDecisionAgainstOpenRaise(PreflopStatusSummary statusSummary, RangeGrid grid, PositionEnum openRaisePosition)
        {
            Logger.Instance.Log($"Pot open raised by {openRaisePosition}, GetDecisionAgainstOpenRaise called.");
            var threeBetChart = ChartUtils.GetDecisionAgaisntOpenRaiseChart(statusSummary.Me.Position, openRaisePosition);
            var decision      = threeBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstOpenRaiseEnum.Fold:
                Logger.Instance.Log($"ThreeBetChart says decision=Fold, grid={grid}, returning decision of Fold.");
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstOpenRaiseEnum.Call:
                Logger.Instance.Log($"ThreeBetChart says decision=Call, grid={grid}, returning decision of Call.");
                return(new Decision(DecisionType.Call, statusSummary.ChipsToCall));

            case DecisionAgainstOpenRaiseEnum.BluffThreeBet:
            case DecisionAgainstOpenRaiseEnum.ValueThreeBet:
                int chipsToAdd = GetThreeBetSize(statusSummary);
                Logger.Instance.Log($"ThreeBetChart says decision={decision}, grid={grid}, returning decision=Reraise, chipsToAdd={chipsToAdd}.");
                return(new Decision(DecisionType.Reraise, chipsToAdd));

            default:
                throw new InvalidCastException();
            }
        }
Exemplo n.º 6
0
        private Decision GetDecisionAgainstThreeBet(PreflopStatusSummary statusSummary, RangeGrid grid, PositionEnum threeBetPosition)
        {
            Logger.Instance.Log($"Pot three bet by {threeBetPosition}, GetDecisionAgainstThreeBet called.");
            var fourBetChart = ChartUtils.GetDecisionAgainstThreeBetChart(statusSummary.Me.Position, threeBetPosition);
            var decision     = fourBetChart.Get(grid);

            switch (decision)
            {
            case DecisionAgainstThreeBetEnum.Fold:
                Logger.Instance.Log($"FourBetChart says decision=Fold, grid={grid}, returning decision of Fold.");
                return(new Decision(DecisionType.Fold, 0));

            case DecisionAgainstThreeBetEnum.Call:
                Logger.Instance.Log($"FourBetChart says decision=Call, grid={grid}, returning decision of Call.");
                return(new Decision(DecisionType.Call, statusSummary.ChipsToCall));

            case DecisionAgainstThreeBetEnum.BluffFourBet:
            case DecisionAgainstThreeBetEnum.ValueFourBet:
                int chipsToAdd = GetFourBetSize(statusSummary);
                Logger.Instance.Log($"FourBetChart says decision={decision}, grid={grid}, returning decision=Reraise, chipsToAdd={chipsToAdd}.");
                return(new Decision(DecisionType.Reraise, chipsToAdd));

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 7
0
        void Initialize()
        {
            IDataProvider dataProvider = DataSource.GetDataProvider();

            SalesbySecorSeries.DataSource = dataProvider.GetSalesBySector(new DateTime(), DateTime.Now, GroupingPeriod.All);

            dailySalesPerformance.SetSalesPerformanceProvider(new DailySalesPerformance(dataProvider));
            monthlySalesPerformance.SetSalesPerformanceProvider(new MonthlySalesPerformance(dataProvider));

            Palette palette = ChartUtils.GeneratePalette();

            chartSalesbySecor.PaletteRepository.Add(palette.Name, palette);
            chartSalesbySecor.PaletteName            = palette.Name;
            chartSalesbySecor.CustomDrawSeriesPoint += ChartUtils.CustomDrawPieSeriesPoint;


            int        year              = DateTime.Today.Year;
            SalesGroup thisYearSales     = dataProvider.GetTotalSalesByRange(new DateTime(year, 1, 1), DateTime.Today);
            decimal    fiscalToDataValue = thisYearSales.TotalCost;

            fiscalToData.Text        = fiscalToDataValue.ToString("$0,0");
            needleFiscalToData.Value = (float)thisYearSales.TotalCost;
            decimal salesForecast = SalesForecastMaker.GetYtdForecast(fiscalToDataValue);

            linearScaleRangeBarForecast.Value = (float)(salesForecast / 1000000);

            int        preYear       = year - 1;
            SalesGroup prevYearSales = dataProvider.GetTotalSalesByRange(new DateTime(preYear, 1, 1), new DateTime(preYear, 12, DateTime.DaysInMonth(preYear, 12)));

            labelFiscalYear.Text   = "FISCAL YEAR " + preYear.ToString();
            fiscalYear.Text        = prevYearSales.TotalCost.ToString("$0,0");
            needleFiscalYear.Value = (float)prevYearSales.TotalCost;
        }
Exemplo n.º 8
0
    /// <summary>
    /// Update the xMin, xMax, yMin, yMax
    /// and indicate where y=0 is only when yMin is less than 0 and yMAx is more than 0.
    /// </summary>
    private void UpdateText()
    {
        if (controller.SeriesCount > 0)
        {
            var minmax = controller.GetMinMaxOfAll();

            yMaxText.text = minmax.yMax.ToString(controller.specifier);
            yMinText.text = minmax.yMin.ToString(controller.specifier);
            xMaxText.text = ChartUtils.SecondsToTime(minmax.xMax);
            xMinText.text = ChartUtils.SecondsToTime(minmax.xMin);

            if (minmax.yMin < 0 && minmax.yMax > 0)
            {
                yZero.SetActive(true);
                yZero.GetComponent <Text>().text = "0";
                float totalY    = minmax.yMax - minmax.yMin;
                float yPos      = -minmax.yMin / totalY * axisHolder.rect.height;
                var   transform = yZero.transform as RectTransform;
                transform.anchoredPosition = new Vector2(transform.anchoredPosition.x, yPos);
            }
            else
            {
                yZero.SetActive(false);
            }
        }
    }
Exemplo n.º 9
0
        public void Test_SecondsToBeat_AfterLastBPMChange()
        {
            // 60BPM for 60 seconds = beat 60
            Assert.AreEqual(
                60,
                ChartUtils.SecondsToBeat(new BPM[] { new BPM(60, 0) }, 60).Value
                );

            // 120BPM for 30 seconds = beat 60
            Assert.AreEqual(
                60,
                ChartUtils.SecondsToBeat(new BPM[] { new BPM(120, 0) }, 30).Value
                );

            // 60BPM -> 120BPM for 45 seconds = beat 60
            Assert.AreEqual(
                60,
                ChartUtils.SecondsToBeat(
                    new BPM[]
            {
                new BPM(60, 0),
                new BPM(120, 30)
            },
                    45
                    ).Value
                );
        }
    /// <summary>
    /// Enter a time and message to show them in the EventPanel.
    /// The text is by default bold, but can be changed for minor event.
    /// </summary>
    /// <param name="time">The timestamp</param>
    /// <param name="message">The message you want to show</param>
    /// <param name="bold">Whether the text should be bold</param>
    public void AddEvent(float time, string message, bool bold = true)
    {
        eventText.text = eventlegendString + " " + ++eventCounts;

        GameObject buttonObject = Instantiate(prefabEventButton, Vector3.zero, Quaternion.identity) as GameObject;

        buttonObject.transform.SetParent(transform);
        buttonObject.transform.localPosition = new Vector3(0, buttonPosition);

        buttonPosition -= buttonHeight + buttonSpacing;

        UnityEngine.UI.Text buttonText = buttonObject.GetComponentInChildren <UnityEngine.UI.Text>();

        buttonText.text = string.Concat(" #", eventCounts + ") " + ChartUtils.SecondsToTime(time), "\r\n [", message, "]");

        if (bold)
        {
            buttonText.fontStyle = FontStyle.Bold;
        }

        RectTransform panelTransform = transform as RectTransform;

        panelTransform.sizeDelta     = new Vector2(panelTransform.rect.width, Mathf.Abs(buttonPosition));
        panelTransform.localPosition = new Vector3(panelTransform.localPosition.x, Mathf.Abs(buttonPosition) - parentHeight);
    }
        public void LoadDiagram2(ref Chart _chart)
        {
            chart2.BackColor = System.Drawing.Color.FromArgb(242, 242, 242);
            ChartUtils.AddChartArea(FormatUtils.Thousand, ref _chart, 0, 0, 1, 0, true, false, false, false, 1, 1);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Bar, string.Empty, System.Drawing.Color.FromArgb(79, 129, 189),
                                          ViewModel.turnoverDiagram, FormatUtils.IntNumber, ref _chart);
        }
        public void LoadDiagram3(ref Chart _chart)
        {
            ChartUtils.AddChartArea(FormatUtils.Thousand, ref _chart, 0, 0, 1, 1, true, false, false, false, 1);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Bar, "Валовая прибыль по товарам",
                                          System.Drawing.Color.FromArgb(149, 179, 215), ViewModel.StructureGrossProfitGoodsDiagram, FormatUtils.Thousand,
                                          ref _chart);
        }
 public void SetText(float time)
 {
     SetActive(true);
     //valueButtonText.text = time.ToString() + " s
     if (time > 0)
     {
         valueButtonText.text = ChartUtils.SecondsToTime(time);
     }
 }
Exemplo n.º 14
0
        public void LoadDiagram1(ref Chart _chart)
        {
            ChartUtils.AddChartArea(string.Empty, ref _chart, 0, 0, 1, 1, true, true, false, false);
            ChartUtils.AddLegend(System.Drawing.StringAlignment.Center, Docking.Top, ref _chart);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Bar, "Закуп", System.Drawing.Color.FromArgb(228, 108, 10),
                                          ViewModel.PurchaseByGoodsDiagram, FormatUtils.Thousand, ref _chart);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Bar, "Продажи", System.Drawing.Color.FromArgb(10, 198, 28),
                                          ViewModel.salesByGoodsDiagram, FormatUtils.Thousand, ref _chart);
        }
Exemplo n.º 15
0
        public async Task <ExecuteChartResult> Execute(ChartRequest request, CancellationToken token)
        {
            var resultTable = await ChartLogic.ExecuteChartAsync(request, token);

            var chartTable = ChartUtils.DataJson(request, resultTable);

            return(new ExecuteChartResult {
                resultTable = resultTable, chartTable = chartTable
            });
        }
Exemplo n.º 16
0
        public ucSalesPerformance()
        {
            InitializeComponent();
            Palette palette = ChartUtils.GeneratePalette();

            chart.PaletteRepository.Add(palette.Name, palette);
            chart.PaletteName            = palette.Name;
            chart.CustomDrawAxisLabel   += ChartUtils.CustomDrawAxisLabel;
            chart.CustomDrawSeriesPoint += ChartUtils.CustomDrawBarSeriesPoint;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Текущий месяц vs Прошлый месяц
        /// </summary>
        public void LoadDiagram(ref Chart _chart)
        {
            ChartUtils.AddChartArea(FormatUtils.ThousandWithK, ref _chart, 0, 0, 0, 0, true, true, true, false);
            ChartUtils.AddLegend(System.Drawing.StringAlignment.Center, Docking.Right, ref _chart);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Bar, "Прошлый месяц", System.Drawing.Color.FromArgb(250, 203, 180),
                                          ViewModel.CurrentMonthDiagram, FormatUtils.Thousand, ref _chart);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Bar, "Текущий месяц", System.Drawing.Color.FromArgb(248, 170, 121),
                                          ViewModel.LastMonthDiagram, FormatUtils.Thousand, ref _chart);
        }
Exemplo n.º 18
0
    void ExtractActionsToButtons(string[] lines, string[] methodStr)
    {
        if (prefabEventButton == null)
        {
            Debug.LogError("You have to assign the prefabButton...");
            return;
        }
        float buttonHeight = prefabEventButton.GetComponent <RectTransform>().rect.height;

        GameObject panel = GameObject.Find("EventButtonPanel");

        if (panel == null)
        {
            Debug.LogError("EventButtonPanel missing...");
            return;
        }
        Vector3       startPosition  = panel.transform.position;
        RectTransform panelTransform = panel.GetComponent <RectTransform>();

        float      buttonPosition = -buttonSpacing;
        GameObject DefaultButton  = Instantiate(prefabEventButton, startPosition, Quaternion.identity) as GameObject;

        DefaultButton.GetComponentInChildren <UnityEngine.UI.Text>().fontStyle = FontStyle.Bold;
        DefaultButton.transform.SetParent(panel.transform);
        DefaultButton.transform.localPosition = new Vector3(0, buttonPosition);
        Button defbutton = DefaultButton.GetComponent <Button>();

        defbutton.onClick.AddListener(delegate { HandleButtonEvent(defbutton, DefaultTime); });
        buttonPosition -= buttonHeight + buttonSpacing;

        foreach (var line in lines)
        {
            foreach (var str in methodStr)
            {
                if (line.Contains(str))
                {
                    GameObject buttonObject = Instantiate(prefabEventButton, startPosition, Quaternion.identity) as GameObject;
                    buttonObject.transform.SetParent(panel.transform);
                    buttonObject.transform.localPosition = new Vector3(0, buttonPosition);

                    buttonPosition -= buttonHeight + buttonSpacing;

                    UnityEngine.UI.Text buttonText = buttonObject.GetComponentInChildren <UnityEngine.UI.Text>();
                    //string timeString = GetLogTime(line);
                    float time = GetLogTimeInSecond(line);
                    buttonText.text = string.Concat(" ", ChartUtils.SecondsToTime(time), "\r\n [", GetLogMessage(line), "]");
                    //buttonText.text = string.Concat(" ", time.ToString(), " s\r\n [", GetLogMessage(line), "]");
                    Button button = buttonObject.GetComponent <Button>();
                    button.onClick.AddListener(delegate { HandleButtonEvent(button, time); });
                }
            }
        }
        panelTransform.sizeDelta = new Vector2(panelTransform.rect.width, Math.Abs(buttonPosition));
    }
Exemplo n.º 19
0
        public void LoadDiagram3(ref Chart _chart)
        {
            chart3.BackColor = System.Drawing.Color.FromArgb(242, 242, 242);
            ChartUtils.AddChartArea(FormatUtils.Thousand, ref _chart);
            ChartUtils.AddLegend(System.Drawing.StringAlignment.Center, Docking.Top, ref _chart);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Column, "Закуп", System.Drawing.Color.FromArgb(228, 108, 10),
                                          ViewModel.PurchaseByClientDiagram, FormatUtils.Thousand, ref _chart);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Column, "Оплачено", System.Drawing.Color.FromArgb(49, 133, 156),
                                          ViewModel.PaymentByClientDiagram, FormatUtils.Thousand, ref _chart);
        }
Exemplo n.º 20
0
        public ManageDataSeriesForm(Chart chart) : this()
        {
            foreach (var ds in chart.Data)
            {
                Series.Add(ds.Value);
            }

            textBoxChartTitle.Text          = chart.Title;
            comboBoxChartType.SelectedIndex = (int)ChartUtils.ToEnum(chart);
            textBoxChartTitle.Text          = chart.Title;
        }
Exemplo n.º 21
0
    private void DrawBarChart()
    {
        if (controller.SeriesCount < 1)
        {
            return;
        }


        float mBarHeight = chartHolder.rect.height;
        float mBarSector = chartHolder.rect.width / controller.SeriesCount;
        float mBarWidth  = mBarSector * 0.67f;

        for (int idx = 0; idx < controller.SeriesCount; idx++)
        {
            float     x        = (idx + 0.5f) * mBarSector;
            float     y        = controller.values[idx] / controller.GetTotalMaxValue() * mBarHeight;
            Vector3[] lines    = new Vector3[] { new Vector3(x, 0), new Vector3(x, y) };
            Mesh      lineMesh = ChartUtils.GenerateLineMesh(lines, mBarWidth);

            string         name     = ChartUtils.NameGenerator(chartChildString, idx);
            GameObject     obj      = chartHolder.Find(name).gameObject;
            CanvasRenderer renderer = obj.GetComponent <CanvasRenderer>();

            renderer.Clear();
            renderer.SetMaterial(controller.materials[idx], null);
            renderer.SetMesh(lineMesh);

            RectTransform rt;
            if (obj.transform.childCount > 0)
            {
                rt = obj.transform.GetChild(0) as RectTransform;
            }
            else
            {
                var go = new GameObject();
                go.transform.SetParent(obj.transform);

                var t = go.AddComponent <Text>();
                t.alignment = TextAnchor.MiddleCenter;
                t.color     = Color.black;
                t.font      = font;

                rt = go.transform as RectTransform;
            }

            rt.localPosition = new Vector3(x, -7);

            var text = obj.GetComponentInChildren <Text>();
            if (text != null)
            {
                text.text = controller.values[idx].ToString();
            }
        }
    }
Exemplo n.º 22
0
        public void OnGet(IdList cnlNums, DateTime startDate, string archive, int?gap)
        {
            // get request parameters and plugin options
            int           cnlNum        = cnlNums != null && cnlNums.Count > 0 ? cnlNums[0] : 0;
            DateTime      utcStartDate  = ChartUtils.GetUtcStartDate(startDate, userContext.TimeZone);
            PluginOptions pluginOptions = new(webContext.AppConfig.GetOptions("Chart"));

            if (!string.IsNullOrEmpty(archive))
            {
                pluginOptions.ChartArchiveCode = archive;
            }

            if (gap.HasValue)
            {
                pluginOptions.GapBetweenPoints = gap.Value;
            }

            // prepare chart data
            ChartDataBuilder chartDataBuilder = new(webContext.ConfigDatabase, clientAccessor.ScadaClient,
                                                    new ChartDataBuilderOptions
            {
                CnlNums = new int[] { cnlNum },
                TimeRange = ChartUtils.GetTimeRange(utcStartDate, 1, true),
                ArchiveBit = webContext.ConfigDatabase.FindArchiveBit(
                    pluginOptions.ChartArchiveCode, ArchiveBit.Minute),
                TimeZone = userContext.TimeZone
            });

            chartDataBuilder.FillCnls();
            chartDataBuilder.FillData();

            // get chart title and status
            dynamic dict = Locale.GetDictionary("Scada.Web.Plugins.PlgChart.Areas.Chart.Pages.Chart");

            ViewData["Title"] = string.Format(dict.Title, cnlNum);
            string chartTitle = string.Format("[{0}] {1}, {2}", cnlNum,
                                              webContext.ConfigDatabase.CnlTable.GetItem(cnlNum)?.Name,
                                              userContext.ConvertTimeFromUtc(utcStartDate).ToLocalizedDateString());
            string chartStatus = dict.Generated + userContext.ConvertTimeFromUtc(DateTime.UtcNow).ToLocalizedString();

            // build client script
            StringBuilder sbChartData = new();

            chartDataBuilder.ToJs(sbChartData);

            sbChartData
            .AppendFormat("var chartTitle = '{0}';", chartTitle.JsEncode()).AppendLine()
            .AppendFormat("var chartStatus = '{0}';", chartStatus.JsEncode()).AppendLine()
            .AppendFormat("var locale = '{0}';", Locale.Culture.Name).AppendLine()
            .AppendFormat("var gapBetweenPoints = {0};", pluginOptions.GapBetweenPoints * 1000).AppendLine()
            .AppendLine();

            ChartDataHtml = new HtmlString(sbChartData.ToString());
        }
Exemplo n.º 23
0
 public override string ToString()
 {
     try
     {
         return(String.Format("High: {0}, Last {1}, Low {2}, Ask {3},Bid {4}, Volume {5}, Time {6}",
                              high, last, low, ask, bid, volume, ChartUtils.UnixTimestampToDateTime(long.Parse(timestamp))));
     }
     catch
     {
         return("Tick:");
     }
 }
        public void LoadDiagram(ref Chart _chart)
        {
            chart.BackColor = System.Drawing.Color.FromArgb(242, 242, 242);
            ChartUtils.AddChartArea(string.Empty, ref _chart, 0, 0, 1, 1, true, false, false, false);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Column, "Продажи", System.Drawing.Color.FromArgb(0, 176, 80),
                                          DateUtils.ConvertToQuarter(ViewModel.DynamicsSalesDiagram, mainModel), FormatUtils.Thousand, ref _chart);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Column, "Оплаты", System.Drawing.Color.FromArgb(147, 169, 207),
                                          DateUtils.ConvertToQuarter(ViewModel.DynamicsPaymentDiagram, mainModel), FormatUtils.Thousand, ref _chart);

            ChartUtils.UpdateAxisTitle(true, mainModel.IsItQuarter, ref _chart);
        }
        public void LoadDiagram(ref Chart _chart)
        {
            ChartUtils.AddChartArea(FormatUtils.ThousandWithK, ref _chart, 0, 0, 1);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Column, "Валовая прибыль", System.Drawing.Color.FromArgb(65, 152, 175),
                                          DateUtils.ConvertToQuarter(ViewModel.GrossProfitDiagram, mainModel), FormatUtils.Thousand, ref _chart);

            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Column, "Чистая прибыль", System.Drawing.Color.FromArgb(145, 195, 213),
                                          DateUtils.ConvertToQuarter(ViewModel.NetProfitDiagram, mainModel), FormatUtils.Thousand, ref _chart);

            ChartUtils.UpdateAxisTitle(true, mainModel.IsItQuarter, ref _chart);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Диаграмма Деньги в кассе / Деньги на счетах
        /// </summary>
        public void LoadDiagram(ref Chart _chart)
        {
            ChartUtils.AddChartArea(string.Empty, ref _chart);
            ChartUtils.AddLegend(System.Drawing.StringAlignment.Center, Docking.Right, ref _chart);

            ChartUtils.AddSeries("Series1", SeriesChartType.Doughnut, ref _chart);

            ChartUtils.AddPoint("Series1", ViewModel.CycleMoneyDiagram["Деньги в кассе"], FormatUtils.Thousand, "Деньги в кассе",
                                System.Drawing.Color.FromArgb(137, 165, 78), ref _chart);
            ChartUtils.AddPoint("Series1", ViewModel.CycleMoneyDiagram["Деньги на счетах"], FormatUtils.Thousand, "Деньги на счетах",
                                System.Drawing.Color.FromArgb(185, 205, 150), ref _chart);
        }
Exemplo n.º 27
0
    /// <summary>
    /// Redraw the axis based on the lenght and height of the chart area.
    /// </summary>
    private void UpdateAxis()
    {
        lines    = new Vector3[4];
        lines[0] = Vector3.zero;
        lines[1] = new Vector3(0, axisHolder.rect.height);
        lines[2] = lines[0];
        lines[3] = new Vector3(axisHolder.rect.width, 0);
        axisMesh = ChartUtils.GenerateLineMesh(lines, 2f);

        //canvasRenderer.Clear();
        canvasRenderer.SetMaterial(ChartUtils.BlackMaterial, null);
        canvasRenderer.SetMesh(axisMesh);
    }
        public void LoadDiagram(ref Chart _chart)
        {
            chart.BackColor = System.Drawing.Color.FromArgb(242, 242, 242);
            ChartUtils.AddChartArea(FormatUtils.Thousand, ref _chart, 0, 0, 1, 0, true, false, false, false, 1, 0);
            ChartUtils.AddLegend(System.Drawing.StringAlignment.Center, Docking.Top, ref _chart);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.StackedColumn, "СОК", System.Drawing.Color.FromArgb(96, 74, 123),
                                          ViewModel.stSokDiagram, FormatUtils.Thousand, ref _chart, false);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.StackedColumn, "Прибыль", System.Drawing.Color.FromArgb(10, 198, 28),
                                          ViewModel.profit, FormatUtils.Thousand, ref _chart, false);
            ChartUtils.AddSeriesAndPoints("Series3", SeriesChartType.StackedColumn, "Задолженность", System.Drawing.Color.FromArgb(204, 193, 218),
                                          ViewModel.stDebtsDiagram, FormatUtils.Thousand, ref _chart, false);
        }
        public void LoadDiagram2(ref Chart _chart)
        {
            ChartUtils.AddChartArea(FormatUtils.Percentage, ref _chart, 0, 0, 1);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Spline, "Валовая рентабельность",
                                          System.Drawing.Color.FromArgb(65, 152, 175), DateUtils.ConvertToQuarter(ViewModel.GrossProfitabilityDiagram, mainModel),
                                          FormatUtils.Percentage, ref _chart);
            ChartUtils.AddSeriesAndPoints("Series2", SeriesChartType.Spline, "Чистая рентабельность",
                                          System.Drawing.Color.FromArgb(145, 195, 213), DateUtils.ConvertToQuarter(ViewModel.NetProfitabilityDiagram, mainModel),
                                          FormatUtils.Percentage, ref _chart);

            ChartUtils.UpdateAxisTitle(true, mainModel.IsItQuarter, ref _chart);
        }
Exemplo n.º 30
0
        private void LoadDiagramm3(ref Chart _chart)
        {
            ChartUtils.ClearChart(ref _chart);

            var data = new Dictionary <string, decimal>();

            data.Add("Факт", ViewModel.NetProfit);
            data.Add("Прогноз", ViewModel.NetProfitForecast);

            ChartUtils.AddChartArea(FormatUtils.ThousandWithK, ref _chart, 0, 0, 1);

            ChartUtils.AddSeriesAndPoints("Series1", SeriesChartType.Column, "Чистая прибыль", System.Drawing.Color.FromArgb(149, 55, 53),
                                          data, FormatUtils.Thousand, ref _chart);
        }