/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); NUniSizeBoxGroup boxGroup = new NUniSizeBoxGroup(stack); stack.Add(new NLabel("Allowed Date Time Units")); NDateTimeUnit[] dateTimeUnits = new NDateTimeUnit[] { NDateTimeUnit.Century, NDateTimeUnit.Decade, NDateTimeUnit.Year, NDateTimeUnit.HalfYear, NDateTimeUnit.Quarter, NDateTimeUnit.Month, NDateTimeUnit.Week, NDateTimeUnit.Day, NDateTimeUnit.HalfDay, NDateTimeUnit.Hour, NDateTimeUnit.Minute, NDateTimeUnit.Second, NDateTimeUnit.Millisecond, NDateTimeUnit.Tick }; m_DateTimeUnitListBox = new NListBox(); for (int i = 0; i < dateTimeUnits.Length; i++) { NDateTimeUnit dateTimeUnit = dateTimeUnits[i]; NCheckBox dateTimeUnitCheckBox = new NCheckBox(NStringHelpers.InsertSpacesBeforeUppersAndDigits(dateTimeUnit.DateTimeUnit.ToString())); dateTimeUnitCheckBox.Checked = true; dateTimeUnitCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnDateTimeUnitCheckBoxCheckedChanged); dateTimeUnitCheckBox.Tag = dateTimeUnit; m_DateTimeUnitListBox.Items.Add(new NListBoxItem(dateTimeUnitCheckBox)); } stack.Add(m_DateTimeUnitListBox); OnDateTimeUnitCheckBoxCheckedChanged(null); NCheckBox enableUnitSensitiveFormattingCheckBox = new NCheckBox("Enable Unit Sensitive Formatting"); enableUnitSensitiveFormattingCheckBox.CheckedChanged += new Function <NValueChangeEventArgs>(OnEnableUnitSensitiveFormattingCheckBoxCheckedChanged); stack.Add(enableUnitSensitiveFormattingCheckBox); enableUnitSensitiveFormattingCheckBox.Checked = true; stack.Add(new NLabel("Start Date:")); m_StartDateTimeBox = new NDateTimeBox(); m_StartDateTimeBox.SelectedDateChanged += new Function <NValueChangeEventArgs>(OnStartDateTimeBoxSelectedDateChanged); stack.Add(m_StartDateTimeBox); stack.Add(new NLabel("End Date:")); m_EndDateTimeBox = new NDateTimeBox(); m_EndDateTimeBox.SelectedDateChanged += new Function <NValueChangeEventArgs>(OnEndDateTimeBoxSelectedDateChanged); stack.Add(m_EndDateTimeBox); NButton generateRandomDataButton = new NButton("Generate Random Data"); generateRandomDataButton.Click += new Function <NEventArgs>(OnGenerateRandomDataButtonClick); stack.Add(generateRandomDataButton); m_StartDateTimeBox.SelectedDate = DateTime.Now; m_EndDateTimeBox.SelectedDate = CultureInfo.CurrentCulture.Calendar.AddYears(m_StartDateTimeBox.SelectedDate, 2); return(boxGroup); }
private void UpdateDateTimeScale() { if (m_DateTimeScale == null) { return; } ArrayList dateTimeUnits = new ArrayList(); if (MillisecondCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Millisecond); } if (SecondCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Second); } if (MinuteCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Minute); } if (HourCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Hour); } if (DayCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Day); } if (WeekCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Week); } if (MonthCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Month); } if (QuarterCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Quarter); } if (HalfYearCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.HalfYear); } if (YearCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Year); } if (DecadeCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Decade); } if (CenturyCheckBox.Checked) { dateTimeUnits.Add(NDateTimeUnit.Century); } NDateTimeUnit[] autoUnits = new NDateTimeUnit[dateTimeUnits.Count]; for (int i = 0; i < autoUnits.Length; i++) { autoUnits[i] = (NDateTimeUnit)dateTimeUnits[i]; } m_DateTimeScale.EnableUnitSensitiveFormatting = EnableUnitSensitiveFormattingCheckBox.Checked; m_DateTimeScale.AutoDateTimeUnits = autoUnits; nChartControl1.Refresh(); }
private void ConfigureScaleRow(int rowIndex, NCheckBox visibleCheckBox, NComboBox rowModeComboBox, NComboBox rowUnitComboBox, NNumericUpDown rowUnitCountUpDown) { NRangeTimelineScaleConfigurator rangeTimelineScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NRangeTimelineScaleConfigurator; NTimelineScaleRow scaleRow; if (rowIndex == 0) { scaleRow = rangeTimelineScale.FirstRow; ((NRangeTimelineScaleRow)scaleRow).LabelStyle.FitMode = RangeLabelFitMode.Clip; } else if (rowIndex == 1) { scaleRow = rangeTimelineScale.SecondRow; } else { scaleRow = rangeTimelineScale.ThirdRow; } scaleRow.Visible = visibleCheckBox.Checked; bool enableUnitControls = false; switch ((TimelineScaleRowTickMode)rowModeComboBox.SelectedIndex) { case TimelineScaleRowTickMode.AutoMinDistance: scaleRow.TickMode = TimelineScaleRowTickMode.AutoMinDistance; break; case TimelineScaleRowTickMode.AutoMaxCount: scaleRow.TickMode = TimelineScaleRowTickMode.AutoMaxCount; break; case TimelineScaleRowTickMode.Custom: enableUnitControls = true; scaleRow.TickMode = TimelineScaleRowTickMode.Custom; scaleRow.CustomStep = new NDateTimeSpan((int)rowUnitCountUpDown.Value, NDateTimeUnit.GetFromEnum((DateTimeUnit)rowUnitComboBox.SelectedIndex)); break; } rowUnitComboBox.Enabled = enableUnitControls; rowUnitCountUpDown.Enabled = enableUnitControls; }