Hi ,
I filling an ultrachart with a numerictimeseries. I want to know if it is possible to remove week end, on the time line ?
Thanks
Hello Eltorfuerte,
I`m not famlar with your scenario, but maybe you could used FillSceneGraph() method and remove weekend from the chart. I made small sample for you with such kind scenario. Please take a look at the attached sample. Also you could take a look at another forum thread where I discuss something similar: http://community.infragistics.com/forums/t/63830.aspx
Also you could take a look in our online documentation. Topic "Customize the display of Null Values": http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/Chart_Customize_the_Display_of_Null_Values.html
Also, maybe you could try other possible approach - to exclude from your DataSet all values with weekends and then to apply your filtered DataSet to your UltraChart.
Please let me know if you have any questions
Hi Thanks a lot for your answer, however it is not exactly what I want . I would like to have every point linked. Which mean that for the example you gave one should not see gap between 09/03/2012 and 12/03/2012 and between 16/03/2012 and 19/03/2012.
Do you know how one can do that ?
If you want to achieve desired bahavior using my sample from the previous post , you should add new Line primitive in FillSceneGraphe() event and drawn a line between the points (with the gap). But this approach is very custom, so my suggestion is to used one of these two approaches below. There are very simple and shorter.
Option 1: Using the properties NullHandling and EmptyStyle:
// Option 1 ultraChart1.ChartType = ChartType.LineChart; ultraChart1.LineChart.NullHandling = NullHandling.InterpolateSimple; ultraChart1.Data.SwapRowsAndColumns = true; ultraChart1.Data.EmptyStyle.EnableLineStyle = true; ultraChart1.Axis.X.Extent = 120; ultraChart1.DataSource = dt;
// Option 1
ultraChart1.ChartType = ChartType.LineChart;
ultraChart1.LineChart.NullHandling = NullHandling.InterpolateSimple;
ultraChart1.Data.SwapRowsAndColumns = true;
ultraChart1.Data.EmptyStyle.EnableLineStyle = true;
ultraChart1.Axis.X.Extent = 120;
ultraChart1.DataSource = dt;
Option 2: Using Linq
// Option 2 ultraChart1.ChartType = ChartType.LineChart; ultraChart1.Data.SwapRowsAndColumns = true; ultraChart1.Axis.X.Extent = 120; var a = from q in dt.AsEnumerable() where q.IsNull(1) != true select q; ultraChart1.DataSource = a.AsDataView();
// Option 2
var a = from q in dt.AsEnumerable()
where q.IsNull(1) != true
select q;
ultraChart1.DataSource = a.AsDataView();
Please take a look at tha new attached sample and screenshot where I show both approaches and let me know if you have any questions.
Thanks for your answer. However, when I try to applicate it to my case I hae a big red cross instead of my graph whenn I use the fillscenegraph thing.
Do you have an idea why ?
Hi,
Did you take a look at the second sample (UltraChartHideWeekend_2.zip) that I already upload in the previous post. The desired behavior is achieved without using FillSceneGraph event.
The mentioned Red cross could appear when you try to modify your current primitive in the FillSceneGraph() event. Could you please upload your sample. I`ll be glad to take a look on it. Let me know if you have any questions.
Regards
Thanks, however, I have already removed Saturday and Friday that is the reason why you have spaces every 5 points on the graph I sent.
Thanks for provided code. My suggestion is to add IF condition and exclude the points for Saturday and Sunday. For example:
for (int i = 0; i < test.Rows.Count; i++) { try { if (Convert.ToDateTime(test.Rows[i][0]).DayOfWeek != DayOfWeek.Saturday && Convert.ToDateTime(test.Rows[i][0]).DayOfWeek != DayOfWeek.Sunday) { InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0], (double)test.Rows[i][9] * 100, "A", false)); } } catch (InvalidCastException) { InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0], Convert.ToDouble(null), "A", false)); } }
for (int i = 0; i < test.Rows.Count; i++)
{
try
if (Convert.ToDateTime(test.Rows[i][0]).DayOfWeek != DayOfWeek.Saturday && Convert.ToDateTime(test.Rows[i][0]).DayOfWeek != DayOfWeek.Sunday)
InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0], (double)test.Rows[i][9] * 100, "A", false));
}
catch (InvalidCastException)
InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0], Convert.ToDouble(null), "A", false));
Let me know if you have any questions.
this is my scenario :
for (int i = 0; i < test.Rows.Count; i++) { try { InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0], (double)test.Rows[i][9] * 100, "A", false)); } catch (InvalidCastException) { InitNumeric.Points.Add(new NumericTimeDataPoint((DateTime)test.Rows[i][0],Convert.ToDouble(null), "A", false)); } }
NewStyle.ApplyGraphic(ChartAlphaRealized, Tick.Name, "Days");
ChartAlphaRealized.CompositeChart.Series.Clear(); ChartAlphaRealized.CompositeChart.Series.Add(InitNumeric);
public void ApplyGraphic(Infragistics.Win.UltraWinChart.UltraChart ChartToStyle, String PlotNAme, String IntervalleDays) { //Set the chart titles ChartToStyle.TitleTop.Text = PlotNAme; ChartToStyle.TitleTop.Font = new Font("Arial", 19, FontStyle.Bold | FontStyle.Regular, GraphicsUnit.Point); //Set Chart legend ChartToStyle.Legend.Visible = true; ChartToStyle.Legend.Location = LegendLocation.Right; ChartToStyle.Legend.Margins.Left = 5; ChartToStyle.Legend.Margins.Right = 10; ChartToStyle.Legend.Margins.Top = 7; ChartToStyle.Legend.Margins.Bottom = 45; ChartToStyle.Legend.SpanPercentage = 15; ChartToStyle.LineChart.TreatDateTimeAsString = false; ChartToStyle.ChartType = ChartType.ScatterChart; ChartToStyle.ScatterChart.ConnectWithLines = true; //axis X ChartToStyle.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd-MM>"; ChartToStyle.Axis.X.Extent = 15; ChartToStyle.Axis.X.Labels.Orientation = TextOrientation.Horizontal; ChartToStyle.Axis.X.Labels.VerticalAlign = StringAlignment.Far; ChartToStyle.Axis.X.TickmarkInterval = 1; if (IntervalleDays == "Days") { ChartToStyle.Axis.X.TickmarkIntervalType = AxisIntervalType.Days; } else { ChartToStyle.Axis.X.TickmarkIntervalType = AxisIntervalType.Weeks; } ChartToStyle.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval; //ChartToStyle.Axis.X.Labels.FontColor = Color.Red; // axis Y ChartToStyle.Axis.Y.TickmarkInterval = 1; // icon size ChartToStyle.ScatterChart.IconSize = SymbolIconSize.Small; // sets the thickness of the line ChartToStyle.ScatterChart.LineAppearance.Thickness = 50; ChartToStyle.LineChart.Thickness = 50; LineAppearance la = new LineAppearance(ChartToStyle); la.IconAppearance.Icon = SymbolIcon.Circle; la.IconAppearance.IconSize = SymbolIconSize.Large; la.LineStyle.EndStyle = LineCapStyle.DiamondAnchor; la.Thickness = 50; // axis font ChartToStyle.Axis.Y.Labels.Font = new Font("Arial", 12, FontStyle.Bold | FontStyle.Regular, GraphicsUnit.Point); ChartToStyle.Axis.X.Labels.Font = new Font("Arial", 12, FontStyle.Bold | FontStyle.Regular, GraphicsUnit.Point); // axis label ChartToStyle.TitleBottom.Text = "Date"; ChartToStyle.TitleBottom.Font = new Font("Arial", 15, FontStyle.Bold | FontStyle.Regular, GraphicsUnit.Point); ChartToStyle.TitleBottom.Margins.Bottom = -1; ChartToStyle.TitleBottom.HorizontalAlign = StringAlignment.Center; //ChartToStyle.TitleLeft.Text = "Alpha cumulated"; ChartToStyle.TitleLeft.Font = new Font("Arial", 15, FontStyle.Bold | FontStyle.Regular, GraphicsUnit.Point); ChartToStyle.TitleLeft.Margins.Bottom = -1; ChartToStyle.TitleLeft.HorizontalAlign = StringAlignment.Center; }
Maybe you should set this property: ultraChart1.Axis.X.TimeAxisStyle.TimeAxisStyle = RulerGenre.Discrete;
Also, could you please upload your sample in this forum thread. I`ll be glad to research your scenario and I`ll try to find solution.Regards
Sorry for the misunderstanding , I meant that you are using Datatable to fill the ultragrid and I am using NumericTimeSeries.
Here is my graph :
As you can see, week ends are visible even if they are not in the numerictimeseries. What I want to do is just to remove the spaces corresponding to it.
Thanks for your help and patience