Example #1
0
        public override void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe)
        {
            if (query.Output.Params["layout"] == ChartTypes.CHART_COLUMNLINE)
            {
                ChartManager.Settings.IsColumnLine = true;
            }
            ChartManager.Settings.ChartType       = ChartSettings.ConvertToChartType(query.Output.Params["layout"], System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
            ChartManager.Settings.UseSettingTitle = true;
            //Custom chart title only works for the language that was selected when the saved query was created.
            if (query.Sources[0].Language.ToLower() == model.Meta.CurrentLanguage.ToLower())
            {
                ChartManager.Settings.Title = CheckParameter(query, "chart_title") ? query.Output.Params["chart_title"] : ChartManager.Settings.Title;
            }
            else
            {
                ChartManager.Settings.Title = model.Meta.Title;
            }
            ChartManager.Settings.Width            = CheckParameter(query, "chart_width") ? int.Parse(query.Output.Params["chart_width"]) : ChartManager.Settings.Width;
            ChartManager.Settings.Height           = CheckParameter(query, "chart_height") ? int.Parse(query.Output.Params["chart_height"]) : ChartManager.Settings.Height;
            ChartManager.Settings.LineThickness    = CheckParameter(query, "chart_linethickness") ? int.Parse(query.Output.Params["chart_linethickness"]) : ChartManager.Settings.LineThickness;
            ChartManager.Settings.TimeSortOrder    = CheckParameter(query, "chart_timesortorder") ? (ChartSettings.SortType)Enum.Parse(typeof(ChartSettings.SortType), query.Output.Params["chart_timesortorder"], true) : ChartManager.Settings.TimeSortOrder;
            ChartManager.Settings.LabelOrientation = CheckParameter(query, "chart_labelorientation") ? (ChartSettings.OrientationType)Enum.Parse(typeof(ChartSettings.OrientationType), query.Output.Params["chart_labelorientation"], true) : ChartManager.Settings.LabelOrientation;
            ChartManager.Settings.Guidelines       = CheckParameter(query, "chart_guidelines") ? (ChartSettings.GuidelinesType)Enum.Parse(typeof(ChartSettings.GuidelinesType), query.Output.Params["chart_guidelines"], true) : ChartManager.Settings.Guidelines;
            ChartManager.Settings.ShowLegend       = CheckParameter(query, "chart_showlegend") ? bool.Parse(query.Output.Params["chart_showlegend"]) : ChartManager.Settings.ShowLegend;
            ChartManager.Settings.LegendHeight     = CheckParameter(query, "chart_legendheight") ? int.Parse(query.Output.Params["chart_legendheight"]) : ChartManager.Settings.LegendHeight;

            base.Render(format, query, model, safe, GetFileExtension(format), GetMimeType(format));
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            ChartSettings settings = ChartManager.Settings;

            settings.IsColumnLine = IsColumnLine(context);
            if (!settings.IsColumnLine)
            {
                settings.ChartType = GetChartType(context, settings);
            }
            else
            {
                settings.ChartType = SeriesChartType.Column;
            }
            settings.Title            = GetTitle(context, settings);
            settings.Width            = GetWidth(context, settings);
            settings.Height           = GetHeight(context, settings);
            settings.LineThickness    = GetLineThickness(context, settings);
            settings.LabelOrientation = GetLabelOrientation(context, settings);
            settings.Guidelines       = GetGuidelines(context, settings);
            settings.ShowLegend       = GetLegend(context, settings);
            settings.LegendHeight     = GetLegendHeight(context, settings);

            PxWebChart chart;

            chart = ChartHelper.GetChart(settings, PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel);

            MemoryStream s = new MemoryStream();

            // Display on screen
            context.Response.ContentType = "image/png";
            chart.SaveImage(s, ImageFormat.Png);

            s.WriteTo(context.Response.OutputStream);
            context.Response.End();
        }
Example #3
0
        public override void Load(Call call, TabModel model)
        {
            _series = new List <ItemCollection <int> >();
            //model.Items = items;

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Add Entry", AddEntry),
                new TaskDelegate("Start: 1 Entry / second", StartTask, true),
            };

            var chartSettings = new ChartSettings();

            for (int i = 0; i < 2; i++)
            {
                var list = new ItemCollection <int>();
                chartSettings.AddList("Series " + i, list);
                _series.Add(list);
            }

            for (int i = 0; i < 10; i++)
            {
                AddSample();
            }
            model.AddObject(chartSettings);
        }
Example #4
0
        private void UpdateSettings()
        {
            ChartSettings settings = ChartManager.Settings;

            settings.CurrentCulture = PCAxis.Web.Core.Management.LocalizationManager.CurrentCulture;
            settings.ChartType      = ChartSettings.ConvertToChartType(GetLayout(), settings.ChartType);
            //settings.Title = txtTitle.Text;
            int t;

            settings.Width            = int.TryParse(txtWidth.Text, out t) ? t : settings.Width;
            settings.Height           = int.TryParse(txtHeight.Text, out t) ? t : settings.Height;
            settings.LineThickness    = int.TryParse(txtLineThickness.Text, out t) ? t : settings.LineThickness;
            settings.LabelOrientation = ChartSettings.ConvertToLabelOrientation(rblLabelOrientation.SelectedValue, settings.LabelOrientation);
            settings.Guidelines       = ChartSettings.GuidelinesType.None;
            if (chkVerticalGuidelines.Checked)
            {
                settings.Guidelines = settings.Guidelines | ChartSettings.GuidelinesType.Vertical;
            }
            if (chkHorizontalGuidelines.Checked)
            {
                settings.Guidelines = settings.Guidelines | ChartSettings.GuidelinesType.Horizontal;
            }
            settings.ShowLegend   = chkShowLegend.Checked;
            settings.LegendHeight = int.TryParse(txtLegendHeight.Text, out t) ? t : settings.LegendHeight;
        }
Example #5
0
 /// <summary>
 /// Read the chart settings from the posted json
 /// </summary>
 void readSettings(JObject json)
 {
     if (json != null)
     {
         if (json["filters"] != null)
         {
             JObject fdata = (JObject)json["filters"];
             foreach (Reports.Filter f in _filters)
             {
                 JToken data = fdata[f.AsString("data")];
                 if (data == null)
                 {
                     continue;
                 }
                 f.Parse(data);
             }
         }
         JObject sdata = (JObject)json["parameters"];
         if (sdata != null)
         {
             _settings = sdata.To <ChartSettings>();
         }
     }
     _y  = _fields.FirstOrDefault(f => f.Name == _settings.Y) ?? _fields.First();
     _x1 = _series.FirstOrDefault(f => f.Name == _settings.X1) ?? _series.First();
     _x2 = _series.FirstOrDefault(f => f.Name == _settings.X2);
     if (_x2 == _x1)
     {
         _x2 = null;
     }
 }
 internal void Refresh(ChartSettings settings)
 {
     CalculateGraphs(settings);
     CalculateArea();
     CalcualteXPhysicalDashes();
     CalcualteYPhysicalDashes();
 }
Example #7
0
 private void BLSChartsBarButton_ItemClick(object sender, ItemClickEventArgs e)
 {
     using (var dialog = new ChartSettings(Settings.Default.ChartsUpdateInterval))
     {
         Settings.Default.ChartsUpdateInterval = dialog.ShowDialog();
         Settings.Default.Save();
         this.beamLineChart.UpdateInterval = Settings.Default.ChartsUpdateInterval;
     }
 }
Example #8
0
        public ChartSettingsViewModel(ChartSettings model)
        {
            _model       = model;
            _defaultYMin = this.GetYMin();
            _defaultYMax = this.GetYMax();

            this.YMin = _defaultYMin;
            this.YMax = _defaultYMax;
        }
Example #9
0
        private bool isDefault(ChartSettings chartSettings)
        {
            var defaultChartSettings = new ChartSettings();

            return
                (chartSettings.SideMarginsEnabled == defaultChartSettings.SideMarginsEnabled &&
                 chartSettings.LegendPosition == defaultChartSettings.LegendPosition &&
                 chartSettings.BackColor == defaultChartSettings.BackColor &&
                 chartSettings.DiagramBackColor == defaultChartSettings.DiagramBackColor);
        }
        private void CalculateGraphs(ChartSettings settings)
        {
            Graphs.Clear();
            foreach (var element in settings.Lines)
            {
                double volume = element.Volume * m_parameters.LotSize;

                Graph graph = new Graph(volume, m_quotes);
                Graphs.Add(graph);
            }
        }
Example #11
0
 protected PopulationAnalysisChart()
 {
     Id                      = ShortGuid.NewGuid();
     ChartSettings           = new ChartSettings();
     ObservedDataCollection  = new ObservedDataCollection();
     Name                    = string.Empty;
     Title                   = string.Empty;
     FontAndSize             = new ChartFontAndSizeSettings();
     _secondaryYAxisSettings = new List <AxisSettings>();
     PrimaryXAxisSettings    = new AxisSettings();
     PrimaryYAxisSettings    = new AxisSettings();
 }
        internal void Update(Parameters parameters, ChartSettings settings, Quotes quotes)
        {
            if (m_grid.BackgroundColor != settings.BackgroundColor)
            {
                m_grid.BackgroundColor = settings.BackgroundColor;
            }
            Quote quote = quotes.Last.Quote;

            int count = (null == quote) ? 0 : settings.Lines.Count;

            Update(count);


            for (int index = 0; index < count; ++index)
            {
                LineSettings line        = settings.Lines[index];
                Color        volumeColor = CalculateColor(line.BidColor, line.AskColor, settings.ForegroundColor);
                Update(settings, index, 0, (float)line.Volume, volumeColor);

                double volume = line.Volume * parameters.LotSize;
                float? bid    = MathEx.CalculateWAVP(volume, quote.Bids);
                float? ask    = MathEx.CalculateWAVP(volume, quote.Asks);
                if (bid.HasValue)
                {
                    bid = (float)MathEx.RoundDown(bid.Value, parameters.PricePip);
                }
                if (ask.HasValue)
                {
                    ask = (float)MathEx.RoundUp(ask.Value, parameters.PricePip);
                }
                Update(settings, index, 1, bid, line.BidColor);
                Update(settings, index, 2, ask, line.AskColor);

                float?spread = null;
                if (bid.HasValue && ask.HasValue)
                {
                    spread = (float)Math.Round(parameters.PriceFactor * (ask.Value - bid.Value));
                }
                Color spreadColor = CalculateColor(line.BidColor, line.AskColor, settings.ForegroundColor);
                Update(settings, index, 3, spread, spreadColor);
            }
            Size size = m_grid.PreferredSize;

            if (this.Size != size)
            {
                this.Size = size;
            }
            //if (!this.Visible)
            //{
            //	this.Visible = true;
            //}
        }
Example #13
0
        /// <summary>
        /// Get title
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart title</returns>
        private string GetTitle(HttpContext context, ChartSettings settings)
        {
            if (PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel.Data.Model.Meta.DescriptionDefault)
            {
                return(PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel.Data.Model.Meta.Description);
            }
            if (QuerystringManager.GetQuerystringParameter(context, ChartParameters.TITLE) != null)
            {
                return(HttpUtility.UrlDecode(QuerystringManager.GetQuerystringParameter(context, ChartParameters.TITLE)));
            }

            return("");
        }
Example #14
0
        /// <summary>
        /// Get show legend
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>If legend shall be displayed in chart or not</returns>
        private bool GetLegend(HttpContext context, ChartSettings settings)
        {
            bool showLegend;

            if (bool.TryParse(QuerystringManager.GetQuerystringParameter(context, ChartParameters.LEGEND), out showLegend))
            {
                return(showLegend);
            }
            else
            {
                return(settings.ShowLegend);
            }
        }
Example #15
0
        private void SetChartSettings()
        {
            //Chart Settings
            double XAxisInterval = Math.Round(MaxVolume / 10.0);
            double XAxisMinValue = 0;
            double XAxisMaxValue = Math.Round(MaxVolume / 10.0) * 10;

            MinTravelTime = int.MaxValue;
            MaxTravelTime = int.MinValue;
            for (int n = 0; n < VolumeTravelTimeList.Count; n++)
            {
                if (MinTravelTime > VolumeTravelTimeList[n][1])
                {
                    MinTravelTime = VolumeTravelTimeList[n][1];
                }
            }
            for (int n = 0; n < VolumeTravelTimeList.Count; n++)
            {
                if (MaxTravelTime < VolumeTravelTimeList[n][1])
                {
                    MaxTravelTime = VolumeTravelTimeList[n][1];
                }
            }
            double YAxisMinValue = MinTravelTime;
            double YAxisMaxValue = MaxTravelTime;
            double YAxisInterval = (MaxTravelTime - MinTravelTime) / 10;

            if ((MaxTravelTime - MinTravelTime) > 10)
            {
                YAxisInterval = Math.Round((MaxTravelTime - MinTravelTime) / 10.0);
                YAxisMaxValue = MinTravelTime + YAxisInterval * 10;
            }
            else if ((MaxTravelTime - MinTravelTime) > 1)
            {
                YAxisInterval = Math.Round((MaxTravelTime - MinTravelTime) / 10.0, 1);
                YAxisMaxValue = MinTravelTime + YAxisInterval * 10;
            }
            else if ((MaxTravelTime - MinTravelTime) > 0)
            {
                YAxisInterval = Math.Round((MaxTravelTime - MinTravelTime) / 2.0, 2);
                YAxisMaxValue = MinTravelTime + YAxisInterval * 2;
            }
            while (YAxisMaxValue < MaxTravelTime)
            {
                YAxisMaxValue = YAxisMaxValue + YAxisInterval;
            }
            string XAxisLabel = "Mainline Traffic Demand Input (veh/h)";
            string YAxisLabel = "Average Facility Travel Time (min)";

            myChartSettings = new ChartSettings(XAxisInterval, XAxisInterval, XAxisMinValue, XAxisMaxValue, YAxisInterval, YAxisInterval, YAxisMinValue, YAxisMaxValue, XAxisLabel, YAxisLabel, true, false);
        }
Example #16
0
        /// <summary>
        /// Get legend height
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart legend height</returns>
        private int GetLegendHeight(HttpContext context, ChartSettings settings)
        {
            int height = 0;

            if (int.TryParse(QuerystringManager.GetQuerystringParameter(context, ChartParameters.LEGENDHEIGHT), out height))
            {
                if (height > 0)
                {
                    return(height);
                }
            }

            return(settings.LegendHeight);
        }
Example #17
0
        /// <summary>
        /// Get Line thickness
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart line thickness</returns>
        private int GetLineThickness(HttpContext context, ChartSettings settings)
        {
            int thickness = 0;

            if (int.TryParse(QuerystringManager.GetQuerystringParameter(context, ChartParameters.LINE_THICKNESS), out thickness))
            {
                if (thickness > 0)
                {
                    return(thickness);
                }
            }

            return(settings.LineThickness);
        }
Example #18
0
 public GanttTypeChart(ChartSettings chartSettings)
 {
     this.chartSettings = new ChartSettings
     {
         Title       = chartSettings.Title ?? "",
         AxisX       = chartSettings.AxisX ?? true,
         AxisXTitle  = chartSettings.AxisXTitle ?? "",
         AxisY       = chartSettings.AxisY ?? true,
         AxisYTitle  = chartSettings.AxisYTitle ?? "",
         Height      = chartSettings.Height ?? 0,
         Legend      = chartSettings.Legend ?? true,
         SeriesColor = chartSettings.SeriesColor ?? ColourValues.ToList(),
         Width       = chartSettings.Width ?? 0
     };
 }
Example #19
0
        /// <summary>
        /// Initializes chart
        /// </summary>
        private void InitializeChart()
        {
            //pnlSettings.Visible = false;

            // Default values for user settings
            ChartSettings settings = ChartManager.Settings;

            settings.ChartType = ChartSettings.ConvertToChartType(GetLayout(), settings.ChartType);

            if (GetLayout().Equals(Plugins.Views.CHART_COLUMNLINE))
            {
                settings.IsColumnLine = true;
            }
            else
            {
                settings.IsColumnLine = false;
            }
            if (settings.UseSettingTitle && !string.IsNullOrEmpty(settings.Title))
            {
                txtTitle.Text = settings.Title;
            }
            else if (PCAxis.Web.Core.Management.PaxiomManager.PaxiomModel != null)
            {
                SetTitle();
            }

            txtHeight.Text                    = settings.Height.ToString();
            txtWidth.Text                     = settings.Width.ToString();
            rblSortTime.SelectedValue         = settings.TimeSortOrder.ToString();
            txtLineThickness.Text             = settings.LineThickness.ToString();
            chkShowLegend.Checked             = settings.ShowLegend;
            txtLegendHeight.Text              = settings.LegendHeight.ToString();
            chkHorizontalGuidelines.Checked   = ((settings.Guidelines & ChartSettings.GuidelinesType.Horizontal) == ChartSettings.GuidelinesType.Horizontal);
            chkVerticalGuidelines.Checked     = ((settings.Guidelines & ChartSettings.GuidelinesType.Vertical) == ChartSettings.GuidelinesType.Vertical);
            rblLabelOrientation.SelectedValue = settings.LabelOrientation.ToString();

            LegendSettings();

            ShowLineThickness();
            ShowSortTime();
            ShowLabelOrientation();
            ShowGuidelines();

            SortTime();
            CreateChart();

            //lnkChartSettings.Text = Master.GetLocalizedString("PxWebChartUserSettingsShow");
        }
Example #20
0
        /// <summary>
        /// Get chart type
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart type</returns>
        private SeriesChartType GetChartType(HttpContext context, ChartSettings settings)
        {
            switch (QuerystringManager.GetQuerystringParameter(context, ChartParameters.CHARTTYPE))
            {
            case Plugins.Views.CHART_LINE:
                return(SeriesChartType.Line);

            case Plugins.Views.CHART_BAR:
                return(SeriesChartType.Bar);

            case Plugins.Views.CHART_COLUMN:
                return(SeriesChartType.Column);

            case Plugins.Views.CHART_PIE:
                return(SeriesChartType.Pie);

            case Plugins.Views.CHART_POPULATIONPYRAMID:
                return(SeriesChartType.Pyramid);

            case Plugins.Views.CHART_COLUMNSTACKED:
                return(SeriesChartType.StackedColumn);

            case Plugins.Views.CHART_BARSTACKED:
                return(SeriesChartType.StackedBar);

            case Plugins.Views.CHART_COLUMNSTACKED100:
                return(SeriesChartType.StackedColumn100);

            case Plugins.Views.CHART_BARSTACKED100:
                return(SeriesChartType.StackedBar100);

            case Plugins.Views.CHART_AREA:
                return(SeriesChartType.Area);

            case Plugins.Views.CHART_AREASTACKED:
                return(SeriesChartType.StackedArea);

            case Plugins.Views.CHART_AREASTACKED100:
                return(SeriesChartType.StackedArea100);

            case Plugins.Views.CHART_POINT:
                return(SeriesChartType.Point);

            case Plugins.Views.CHART_RADAR:
                return(SeriesChartType.Radar);
            }
            return(settings.ChartType);
        }
Example #21
0
        private async Task SendChartMessage(ChartSettings chartSettings, Embed embed)
        {
            await this._chartService.GenerateChartAsync(chartSettings);

            // Send chart memory stream, remove when finished
            using (var memory = await GlobalVars.GetChartStreamAsync(chartSettings.DiscordUser.Id))
            {
                await this.Context.Channel.SendFileAsync(memory, "chart.png", null, false, embed);
            }

            lock (GlobalVars.charts.SyncRoot)
            {
                // @TODO: remove only once in a while to keep it cached
                GlobalVars.charts.Remove(GlobalVars.GetChartFileName(chartSettings.DiscordUser.Id));
            }
        }
Example #22
0
        public override void Render(string format, PCAxis.Query.SavedQuery query, PCAxis.Paxiom.PXModel model, bool safe)
        {
            ChartManager.Settings.ChartType        = ChartSettings.ConvertToChartType(query.Output.Params["layout"], System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
            ChartManager.Settings.UseSettingTitle  = true;
            ChartManager.Settings.Title            = CheckParameter(query, "chart_title") ? query.Output.Params["chart_title"] : ChartManager.Settings.Title;
            ChartManager.Settings.Width            = CheckParameter(query, "chart_width") ? int.Parse(query.Output.Params["chart_width"]) : ChartManager.Settings.Width;
            ChartManager.Settings.Height           = CheckParameter(query, "chart_height") ? int.Parse(query.Output.Params["chart_height"]) : ChartManager.Settings.Height;
            ChartManager.Settings.LineThickness    = CheckParameter(query, "chart_linethickness") ? int.Parse(query.Output.Params["chart_linethickness"]) : ChartManager.Settings.LineThickness;
            ChartManager.Settings.TimeSortOrder    = CheckParameter(query, "chart_timesortorder") ? (ChartSettings.SortType)Enum.Parse(typeof(ChartSettings.SortType), query.Output.Params["chart_timesortorder"], true) : ChartManager.Settings.TimeSortOrder;
            ChartManager.Settings.LabelOrientation = CheckParameter(query, "chart_labelorientation") ? (ChartSettings.OrientationType)Enum.Parse(typeof(ChartSettings.OrientationType), query.Output.Params["chart_labelorientation"], true) : ChartManager.Settings.LabelOrientation;
            ChartManager.Settings.Guidelines       = CheckParameter(query, "chart_guidelines") ? (ChartSettings.GuidelinesType)Enum.Parse(typeof(ChartSettings.GuidelinesType), query.Output.Params["chart_guidelines"], true) : ChartManager.Settings.Guidelines;
            ChartManager.Settings.ShowLegend       = CheckParameter(query, "chart_showlegend") ? bool.Parse(query.Output.Params["chart_showlegend"]) : ChartManager.Settings.ShowLegend;
            ChartManager.Settings.LegendHeight     = CheckParameter(query, "chart_legendheight") ? int.Parse(query.Output.Params["chart_legendheight"]) : ChartManager.Settings.LegendHeight;

            base.Render(format, query, model, safe, GetFileExtension(format), GetMimeType(format));
        }
        private Color[] getUsedColors(ChartSettings chartSettings, ChartData <TXValue, TYValue> chartData)
        {
            var colors = new HashSet <Color>();

            colors.Add(chartSettings.BackColor);
            colors.Add(chartSettings.DiagramBackColor);

            foreach (var curve in chartData.Panes.SelectMany(pane => pane.Curves))
            {
                colors.Add(curve.Color);
            }
            foreach (var observedCurve in chartData.Panes.SelectMany(pane => pane.ObservedCurveData.Where(c => c.Visible)))
            {
                colors.Add(observedCurve.Color);
            }

            return(colors.ToArray());
        }
Example #24
0
        public ChartSettings SetExtraSettings(ChartSettings currentChartSettings, string[] extraOptions)
        {
            var chartSettings = currentChartSettings;

            if (extraOptions.Contains("notitles") || extraOptions.Contains("nt"))
            {
                chartSettings.TitlesEnabled = false;
            }

            if (extraOptions.Contains("skipemptyimages") ||
                extraOptions.Contains("skipemptyalbums") ||
                extraOptions.Contains("skipalbums") ||
                extraOptions.Contains("skip") ||
                extraOptions.Contains("s"))
            {
                chartSettings.SkipArtistsWithoutImage = true;
            }

            return(chartSettings);
        }
Example #25
0
        /// <summary>
        /// Get guidelines
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart guidelines</returns>
        private ChartSettings.GuidelinesType GetGuidelines(HttpContext context, ChartSettings settings)
        {
            ChartSettings.GuidelinesType guidelines = ChartSettings.GuidelinesType.None;

            if ((QuerystringManager.GetQuerystringParameter(context, ChartParameters.GUIDELINES_HORIZONTAL) != null) || (QuerystringManager.GetQuerystringParameter(context, ChartParameters.GUIDELINES_VERTICAL) != null))
            {
                if (QuerystringManager.GetQuerystringParameter(context, ChartParameters.GUIDELINES_HORIZONTAL).ToLower() == "true")
                {
                    guidelines = guidelines | ChartSettings.GuidelinesType.Horizontal;
                }
                if (QuerystringManager.GetQuerystringParameter(context, ChartParameters.GUIDELINES_VERTICAL).ToLower() == "true")
                {
                    guidelines = guidelines | ChartSettings.GuidelinesType.Vertical;
                }

                return(guidelines);
            }

            return(settings.Guidelines);
        }
Example #26
0
        /// <summary>
        /// Get width
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart width</returns>
        private int GetWidth(HttpContext context, ChartSettings settings)
        {
            int width = 0;

            if (int.TryParse(QuerystringManager.GetQuerystringParameter(context, ChartParameters.WIDTH), out width))
            {
                if (width > 0)
                {
                    if (width > PXWeb.Settings.Current.Features.Charts.MaxWidth)
                    {
                        return(PXWeb.Settings.Current.Features.Charts.MaxWidth);
                    }
                    else
                    {
                        return(width);
                    }
                }
            }

            return(settings.Width);
        }
Example #27
0
        /// <summary>
        /// Get height
        /// </summary>
        /// <param name="context">Http context</param>
        /// <param name="settings">Chart settings object</param>
        /// <returns>Chart height</returns>
        private int GetHeight(HttpContext context, ChartSettings settings)
        {
            int height = 0;

            if (int.TryParse(QuerystringManager.GetQuerystringParameter(context, ChartParameters.HEIGHT), out height))
            {
                if (height > 0)
                {
                    if (height > PXWeb.Settings.Current.Features.Charts.MaxHeight)
                    {
                        return(PXWeb.Settings.Current.Features.Charts.MaxHeight);
                    }
                    else
                    {
                        return(height);
                    }
                }
            }

            return(settings.Height);
        }
Example #28
0
 private void OnOptions(object sender, EventArgs e)
 {
     try
     {
         ChartSettings       oldSettings = new ChartSettings(m_settings);
         ChartSettingsDialog dialog      = new ChartSettingsDialog(this);
         DialogResult        result      = dialog.ShowDialog();
         if (DialogResult.Cancel == result)
         {
             m_settings = oldSettings;
         }
         else if (DialogResult.Yes == result)
         {
             ChartSettingsManager.Save(m_parameters.Symbol, m_settings);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private object GetDeveloperChart()
        {
            var listGroup = new ListGroup("Sales by Developer")
            {
                XBinSize = 1,
            };

            listGroup.AddDimensions(Tab.Database.ReleaseViews,
                                    nameof(ReleaseView.Developer),
                                    nameof(ReleaseView.YearOfRelease),
                                    nameof(ReleaseView.Global_Sales));

            var chartSettings = new ChartSettings(listGroup);
            var model         = new TabModel()
            {
                MinDesiredWidth = 1000,
            };

            model.AddObject(chartSettings);
            return(model);
        }
Example #30
0
        public async Task LoadAsync(Call call, TabModel model)
        {
            await Task.Delay(10);

            var list          = new List <TimeRangeValue>();
            var chartSettings = new ChartSettings(list, "Active Connection Count");

            DateTime startTime = DateTime.Now;

            for (int i = 0; i < 24; i++)
            {
                var value = new TimeRangeValue()
                {
                    StartTime = startTime,
                    EndTime   = startTime.AddHours(1),
                    Value     = (random.Next() % 5),
                };
                list.Add(value);
                startTime = startTime.AddHours(1);
            }
            model.AddObject(chartSettings);
        }