Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi,

                                    See attached picture.

                                    Is it possible to have my XAxis labels on a scale so they appear on the graph much neater? They araphire a datetime value?

                                    Also I would like to specify the color of each bar how would I go about that?

                                    I am using the chart components for MVC?

                                    Manyh thanks,

                                    Paul

                                graph.png
                                Show all comments
                                • Hi Paul,

                                  Unfortunately, it is difficult to clearly diagnose this problem without being able to reproduce it locally.
                                  Please make sure that you have set the Series.ArgumentScaleType property to "DateTime".
                                  To define different colors for bars, define the SideBySideBarSeriesView.ColorEach property to true.
                                  Alternatively, you can handle the CustomDrawSeriesPoint event and define the color for each point.

                                  Thanks,
                                  Andrew

                                • Paul Townsend 1 08.02.2011

                                  Hi,

                                  As soon as I change series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.DateTime the chart dissapears - see attached image for an example, when I comment that line out the chart reappears again with no scaling - below is my code am I missing something?

                                      settingsChart1.Name = "chart1";
                                      settingsChart1.BorderOptions.Visible = false;
                                      settingsChart1.Height = 300;
                                      settingsChart1.Width = 900;
                                      settingsChart1.SeriesTemplate.Label.Visible = false;
                                      settingsChart1.SeriesDataMember = "Time";
                                      settingsChart1.Legend.Visible = false;

                                      settingsChart1.Titles.Add(new DevExpress.XtraCharts.ChartTitle()
                                      {
                                          Font = new Font("Tahoma", 18),
                                          Text = "1 minute LEQs"
                                      });

                                      DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series();
                                      settingsChart1.Series.Clear();
                                      settingsChart1.Series.Add(series1);
                                      series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.DateTime;
                                      series1.ValueDataMembers[0] = "LEQ";
                                      series1.ArgumentDataMember = "Time";
                                      series1.Label.Visible = false;
                                      series1.ShowInLegend = false;
                                      series1.ChangeView(DevExpress.XtraCharts.ViewType.Bar);
                                      
                                      DevExpress.XtraCharts.XYDiagram diagramChart1 = (DevExpress.XtraCharts.XYDiagram)settingsChart1.Diagram;
                                      diagramChart1.AxisY.Interlaced = true;
                                      diagramChart1.AxisY.Title.Text = "dB(A) Leq";
                                      diagramChart1.AxisX.Title.Text = "Time";
                                      diagramChart1.AxisY.Title.Visible = true;
                                      
                                      series1.DataSource = Model.Readings;

                                      Html.DevExpress().Chart(settingsChart1)
                                      .Render();

                                • Hi Paul,

                                  It is difficult to clearly diagnose this problem without being able to reproduce it locally.
                                  Could you please provide us with a sample illustrating your issue?
                                  We will examine it, and do our best to help you.

                                  Thanks,
                                  Andrew

                                • Paul Townsend 1 08.02.2011

                                  Hi Andrew,

                                  Please see attached example.

                                  If you run with and without the line "series1.ArgumentScaleType = ScaleType.DateTime" and see the difference.

                                  Regards,

                                  Paul

                                • Hi Paul,

                                  Thank you for your sample.
                                  1. In this case, do not utilize SeriesTemplates. Instead, use a single series.
                                  Thus, the following code is not necessary:

                                  [C#]
                                  settingsChart1.SeriesTemplate.ChangeView(DevExpress.XtraCharts.ViewType.Line); settingsChart1.SeriesTemplate.Label.Visible = false; settingsChart1.SeriesDataMember = "Time";
                                  2. Customize the date time scale:
                                  [C#]
                                  diagramChart1.AxisX.DateTimeGridAlignment = DateTimeMeasurementUnit.Hour; diagramChart1.AxisX.DateTimeMeasureUnit = DateTimeMeasurementUnit.Minute; diagramChart1.AxisX.DateTimeOptions.Format = DateTimeFormat.ShortTime;
                                  3. Customize the bar width according to the measure unit and GridAlignment.
                                  [C#]
                                  ((BarSeriesView)series1.View).BarWidth = 0.01;
                                  We look forward to your feedback once you have had the opportunity to review the attached project.

                                  Thanks,
                                  Andrew

                                • Paul Townsend 1 08.03.2011

                                  Hi,

                                  That has not resolved my problem. If I plot 1500 items as you can see the XAxis labels just look like a big shadow - I just want to see 4-5 labels evenly distributed so you can get a feel for the time frame.

                                  Regards,

                                  Paul

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Paul

                                Thank you for your feedback. Define the AxisX.CustomLabels to replace the default ones.

                                For example:

                                [C#]
                                foreach(ChartExample.Models.NameValue nv in Model) { SeriesPoint point = new SeriesPoint(nv.Time,nv.Interval); int posotion = series1.Points.Add(point); } diagramChart1.AxisX.CustomLabels.Add(new CustomAxisLabel(series1.Points[0].Argument, series1.Points[0].Argument)); diagramChart1.AxisX.CustomLabels.Add(new CustomAxisLabel(series1.Points[series1.Points.Count / 2].Argument, series1.Points[series1.Points.Count / 2].Argument)); diagramChart1.AxisX.CustomLabels.Add(new CustomAxisLabel(series1.Points[series1.Points.Count -1].Argument, series1.Points[series1.Points.Count -1].Argument));
                                Please try this solution and let us know your results.

                                Thanks,
                                Andrew

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners