private RadCartesianChartView createChart()
        {
            RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

            BarSeries series = new BarSeries();

            DateTimeContinuousAxis axis = new DateTimeContinuousAxis();

            axis.LabelFormat      = "MM/dd";
            series.HorizontalAxis = axis;

            LinearAxis verticalAxis = new LinearAxis();

            verticalAxis.LabelFormat = "%.0f";
            series.VerticalAxis      = verticalAxis;

            series.ValueBinding    = new ValueBinding();
            series.CategoryBinding = new CategoryBinding();

            series.Data = this.getData();

            chart.Series.Add(series);

            return(chart);
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();
            InitializeDropDownList();

            this.EnabledQSFButtons = QSFButtons.None;

            BarSeries barSerias = new BarSeries();

            barSerias.ValueMember    = "Value";
            barSerias.CategoryMember = "Date";
            barSerias.DataSource     = DrillDownViewModel.ParseDataByYear();

            radChartView1.Views.AddNew();
            radChartView1.Views.AddNew();
            radChartView1.Title = "Revenue by Years";
            this.radChartView1.ChartElement.ShowTitle = true;
            radChartView1.ChartElement.TitlePosition  = TitlePosition.Top;
            DrillDownController controller = new DrillDownController();

            this.radChartView1.Controllers.Add(controller);
            this.radChartView1.Drill += new DrillEventHandler(radChartView1_Drill);
            this.radChartView1.ShowDrillNavigation = true;
            FillColors(this.radChartView1.View, KnownPalette.Warm);

            DateTimeContinuousAxis horizontalAxis = new DateTimeContinuousAxis();

            horizontalAxis.MajorStepUnit = Charting.TimeInterval.Year;
            horizontalAxis.MajorStep     = 1;
            horizontalAxis.LabelFormat   = "{0:yyyy}";
            horizontalAxis.Title         = "Year";

            LinearAxis verticalAxis = new LinearAxis();

            verticalAxis.AxisType    = AxisType.Second;
            verticalAxis.Title       = "USD";
            barSerias.HorizontalAxis = verticalAxis;

            barSerias.VerticalAxis = horizontalAxis;


            radChartView1.Series.Add(barSerias);
            this.radChartView1.LabelFormatting += new ChartViewLabelFormattingEventHandler(radChartView1_LabelFormatting);
            this.radChartView1.ShowTrackBall    = false;

            //smartLabelsController.Strategy = new FalpLabelStrategy();


            this.radChartView1.Controllers.Add(smartLabelsController);
            CartesianArea area = this.radChartView1.GetArea <CartesianArea>();

            area.ShowGrid = true;

            this.FillBarSeries(barSerias);
        }
Beispiel #3
0
        // ###############################################################################################
        //  Adjust axis
        internal static DateTimeContinuousAxis AdjustAxis(DateTimeContinuousAxis DateTimeAxis, string timeSpan)
        {
            switch (timeSpan)
            {
            case "hour":
                DateTimeAxis.LabelFormat   = "{0:HH:mm}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Minute;
                DateTimeAxis.MajorStep     = 10;
                DateTimeAxis.Minimum       = DateTime.Now.AddHours(-1);
                break;

            case "day":
                DateTimeAxis.LabelFormat   = "{0:HH:mm}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Hour;
                DateTimeAxis.MajorStep     = 6;
                DateTimeAxis.Minimum       = DateTime.Now.AddDays(-1);
                break;

            case "week":
                DateTimeAxis.LabelFormat   = "{0:ddd d}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Day;
                DateTimeAxis.MajorStep     = 1;
                DateTimeAxis.Minimum       = DateTime.Now.AddDays(-7);
                break;

            case "month":
                DateTimeAxis.LabelFormat   = "{0:d/M}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Week;
                DateTimeAxis.MajorStep     = 1;
                DateTimeAxis.Minimum       = DateTime.Now.AddMonths(-1);
                break;

            case "year":
                DateTimeAxis.LabelFormat   = "{0:MMM}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Month;
                DateTimeAxis.MajorStep     = 1;
                DateTimeAxis.Minimum       = DateTime.MinValue;
                break;

            case "all":
                DateTimeAxis.LabelFormat   = "{0:MMM/yy}";
                DateTimeAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Month;
                DateTimeAxis.MajorStep     = 4;
                DateTimeAxis.Minimum       = DateTime.MinValue;
                break;
            }
            return(DateTimeAxis);
        }
		private RadCartesianChartView createChart(){
			RadCartesianChartView chart = new RadCartesianChartView(this.Activity);

			BarSeries series = new BarSeries();

			DateTimeContinuousAxis axis = new DateTimeContinuousAxis();
			axis.LabelFormat = "MM/dd";
			series.HorizontalAxis = axis;

			LinearAxis verticalAxis = new LinearAxis();
			verticalAxis.LabelFormat = "%.0f";
			series.VerticalAxis = verticalAxis;

			series.ValueBinding = new ValueBinding();
			series.CategoryBinding = new CategoryBinding();

			series.Data = this.getData();

			chart.Series.Add(series);

			return chart;
		}
Beispiel #5
0
        private void SetupChartView()
        {
            DateTimeContinuousAxis horizontalAxis = new DateTimeContinuousAxis();
            horizontalAxis.LabelFormat = "{0:m:ss:ff}";
            horizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine;
            horizontalAxis.PlotMode = AxisPlotMode.OnTicks;
            horizontalAxis.Title = "Time";
            horizontalAxis.MaximumTicks = 15;

            LineSeries throttlePedal = new LineSeries();
            throttlePedal.LegendTitle = "Throttle pedal";
            throttlePedal.ValueMember = "ThrottlePedal";
            throttlePedal.CategoryMember = "Time";
            LinearAxis throttleAxis = new LinearAxis();
            throttleAxis.HorizontalLocation = AxisHorizontalLocation.Right;
            throttleAxis.AxisType = AxisType.Second;
            throttleAxis.Title = "Throttle, %";
            throttleAxis.Minimum = -250;
            throttleAxis.Maximum = 100;
            throttlePedal.VerticalAxis = throttleAxis;
            throttlePedal.HorizontalAxis = horizontalAxis;

            LineSeries brakePedal = new LineSeries();
            brakePedal.LegendTitle = "Brake pedal";
            brakePedal.ValueMember = "BrakePedal";
            brakePedal.CategoryMember = "Time";
            LinearAxis brakeAxis = new LinearAxis();
            brakeAxis.HorizontalLocation = AxisHorizontalLocation.Right;
            brakeAxis.AxisType = AxisType.Second;
            brakeAxis.Title = "Brake, %";
            brakeAxis.Minimum = -250;
            brakeAxis.Maximum = 100;
            brakePedal.VerticalAxis = brakeAxis;
            brakePedal.HorizontalAxis = horizontalAxis;

            LineSeries engineRpm = new LineSeries();
            engineRpm.LegendTitle = "Engine RPM";
            engineRpm.ValueMember = "EngineRpm";
            engineRpm.CategoryMember = "Time";
            LinearAxis engineRpmAxis = new LinearAxis();
            engineRpmAxis.AxisType = AxisType.Second;
            engineRpmAxis.Title = "Engine RPM";
            engineRpmAxis.Minimum = 2000;
            engineRpmAxis.Maximum = 10000;
            engineRpm.VerticalAxis = engineRpmAxis;
            engineRpm.HorizontalAxis = horizontalAxis;

            BarSeries gear = new BarSeries();
            gear.LegendTitle = "Gear";
            gear.ValueMember = "Gear";
            gear.CategoryMember = "Time";
            LinearAxis gearAxis = new LinearAxis();
            gearAxis.AxisType = AxisType.Second;
            gearAxis.Title = "Gear";
            gearAxis.Maximum = 30;
            gearAxis.DesiredTickCount = 40;
            gear.VerticalAxis = gearAxis;
            gear.HorizontalAxis = horizontalAxis;

            LineSeries speed = new LineSeries();
            speed.LegendTitle = "Speed";
            speed.ValueMember = "Speed";
            speed.CategoryMember = "Time";
            LinearAxis speedAxis = new LinearAxis();
            speedAxis.AxisType = AxisType.Second;
            speedAxis.Title = "Speed, km/h";
            speedAxis.Minimum = 0;
            speedAxis.Maximum = 500;
            speed.VerticalAxis = speedAxis;
            speed.HorizontalAxis = horizontalAxis;

            this.radChartView1.Series.Add(gear);
            this.radChartView1.Series.Add(brakePedal);
            this.radChartView1.Series.Add(throttlePedal);
            this.radChartView1.Series.Add(speed);
            this.radChartView1.Series.Add(engineRpm);
            
            throttleAxis.LabelOffset = 5;
            brakeAxis.LabelOffset = 5;
            gearAxis.LabelOffset = 1;

            for (int i = 0; i < gearAxis.Children.Count; i++)
            {
                AxisLabelElement gearLabel = gearAxis.Children[i] as AxisLabelElement;

                if (gearLabel != null && int.Parse(gearLabel.Text) > 6)
                {
                    gearLabel.IsVisible = false;
                }
            }
        }