Пример #1
0
 private static TestRecord BuildTestRecord(RangeSelector r)
 => new(r.StepFrequency, r.Minimum, r.RangeStart, r.RangeEnd, r.Maximum);
Пример #2
0
 /// <summary>
 /// The range selector is a tool for selecting ranges to display within the chart.
 /// It provides buttons to select preconfigured ranges in the chart,
 /// like 1 day, 1 week, 1 month etc. It also provides input boxes
 /// where min and max dates can be manually input.
 /// This object contains all the options which can be applied to this part of the chart.
 /// </summary>
 /// <remarks>This is available only with Highstock.</remarks>
 /// <param name="rangeSelector">
 /// A reference to a <see cref="RangeSelector"/> object containing the selected options.
 /// </param>
 /// <returns>A reference to this class, useful for chained settings.</returns>
 public Highstock SetRangeSelector(RangeSelector rangeSelector)
 {
     _RangeSelector = rangeSelector;
     return(this);
 }
        private void OnSchemaChanged(DataSchemaItem dataSchemaItem)
        {
            if (!_templateApplied || dataSchemaItem == null)
            {
                return;
            }

            PART_ControlPanel.Children.Clear();

            Title = dataSchemaItem.PropertyLabel;

            switch (dataSchemaItem.DataType)
            {
            case DataType.FromSource:
                var lv = new ListView
                {
                    ItemsSource   = dataSchemaItem.DataSource,
                    SelectionMode = dataSchemaItem.IsMultiSelect ? ListViewSelectionMode.Multiple : ListViewSelectionMode.Single,
                    ItemsPanel    = PART_ControlPanel.Resources["2RowUniformGridPanelTemplate"] as ItemsPanelTemplate
                };

                lv.SelectionChanged += DataSource_SelectionChanged;
                _controlObject       = lv;

                break;

            case DataType.Range:

                var slider = new RangeSelector
                {
                    Minimum = dataSchemaItem.Min,
                    Maximum = dataSchemaItem.Max,
                };

                slider.ValueChanged += Slider_ValueChanged;

                _controlObject = slider;

                break;

            case DataType.Boolean:

                var toggle = new ToggleButton
                {
                    Content = dataSchemaItem.PropertyLabel
                };

                PART_TitlePresenter.Visibility = Visibility.Collapsed;

                toggle.Checked   += Toggle_CheckedChanged;
                toggle.Unchecked += Toggle_CheckedChanged;

                _controlObject = toggle;
                break;

            default:
                break;
            }

            PART_ControlPanel.Children.Add(_controlObject);
        }
Пример #4
0
 public void Setup()
 {
     _flattner = new Mock <ITreeItemHierarchyFlattener>();
     _selector = new RangeSelector(_flattner.Object);
 }
Пример #5
0
 public static RangeFilter Create(RangeSelector rangeSelector)
 {
     return(new RangeFilter(rangeSelector));
 }
Пример #6
0
 private RangeFilter(RangeSelector rangeSelector)
 {
     _rangeSelector = rangeSelector;
     _rangeSelector.PropertyChanged += RangeSelectorOnPropertyChanged;
 }
Пример #7
0
        public async Task <ActionResult> Ranking(string url = null)
        {
            ViewBag.Title = Localization.XomorodRanking;
            var alexa  = new Alexa(url ?? SecurityKeys.WebSiteRout);
            var trends = ConnectionManager.GetDefaultConnection().SqlConn.Query("Select * From dbo.udft_TrafficRankings()").ToList();

            var gData = new object[trends.Count(), 2]; // global ranking data
            var iData = new object[trends.Count(), 2]; // iran ranking data

            for (var i = 0; i < trends.Count(); i++)
            {
                // The x value of the point. For datetime axes, the X value is the timestamp in milliseconds since 1970.
                gData[i, 0] = new TimeSpan(((DateTime)trends[i].ModifyDate).Subtract(new DateTime(1970, 1, 1)).Ticks).TotalMilliseconds;
                iData[i, 0] = gData[i, 0];

                // The y value of the point. Defaults to null.
                gData[i, 1] = (double)trends[i].GlobalRanking;
                iData[i, 1] = (double)trends[i].IranRanking;
            }

            var rangeSelect = new RangeSelector()
            {
                Buttons = new[] {
                    //new ButtonsItems() { Type = "hour", Count = 12, Text = "12h" },
                    new ButtonsItems()
                    {
                        Type = "day", Count = 3, Text = Localization._3day
                    },
                    new ButtonsItems()
                    {
                        Type = "week", Count = 1, Text = Localization._1week
                    },
                    new ButtonsItems()
                    {
                        Type = "month", Count = 1, Text = Localization._1month
                    },
                    new ButtonsItems()
                    {
                        Type = "month", Count = 6, Text = Localization._6month
                    },
                    new ButtonsItems()
                    {
                        Type = "year", Count = 1, Text = Localization._1year
                    },
                    new ButtonsItems()
                    {
                        Type = "all", Text = Localization.All
                    }
                },
                Selected = 5
            };

            DotNet.Highstock.Highstock gChart = new DotNet.Highstock.Highstock("gStockChart");
            DotNet.Highstock.Highstock iChart = new DotNet.Highstock.Highstock("iStockChart");

            gChart.SetTitle(new Title()
            {
                Text = Localization.GlobalHistoricalTrafficTrends
            });
            iChart.SetTitle(new Title()
            {
                Text = Localization.IranHistoricalTrafficTrends
            });

            gChart.SetYAxis(new[] { new YAxis {
                                        Title = new YAxisTitle()
                                        {
                                            Text = Localization.RankingScore
                                        }, LineWidth = 2
                                    } });
            iChart.SetYAxis(new[] { new YAxis {
                                        Title = new YAxisTitle()
                                        {
                                            Text = Localization.RankingScore
                                        }, LineWidth = 2
                                    } });

            gChart.SetSeries(
                new Series()
            {
                Data      = new Data(gData),
                Color     = Color.DeepSkyBlue,
                DashStyle = DashStyles.Solid,
                Type      = ChartTypes.Line,
                Name      = "Global"
            });

            iChart.SetSeries(
                new Series()
            {
                Data      = new Data(iData),
                Color     = Color.Aquamarine,
                DashStyle = DashStyles.Solid,
                Type      = ChartTypes.Column,
                Name      = "Iran"
            });

            gChart.SetRangeSelector(rangeSelect);
            iChart.SetRangeSelector(rangeSelect);

            ViewData.Add("GlobalChart", gChart);
            ViewData.Add("IranChart", iChart);

            var ps = new PageSpeed(url ?? SecurityKeys.WebSiteRout)
            {
                Screenshot = true
            };
            await ps.AnalyzeAsync();

            return(View(Tuple.Create(alexa, ps)));
        }
		public void RangeSelectorValuesChanged(RangeSelector rs)
		{
			Product.MinStockAvailable = (int)rs.RangeMin;
			Product.MaxStockAvailable = (int)rs.RangeMax;
		}
		public void UpdateRangeSelector(RangeSelector rs)
		{
			rs.RangeMin = Product.MinStockAvailable;
			rs.RangeMax = Product.MaxStockAvailable;
		}