Hi ,
I would like to know how I can initialize a numericserie ?.
I am using a ultrachart and each time I want to plot something with my macro the graph overlap with the previous one because the numericseries still keep info from the previopus graph.
Thanks
HI,
I`m not sure that I understand your scenario, but maybe you are talking about your Layer which contains your series. For example:
series2 = new NumericTimeSeries();series2.Label = "test2";series2.PEs.Add(new PaintElement(Color.Blue));series2.Points.Add(new NumericTimeDataPoint(DateTime.Today, 10, "test2", false));series2.Points.Add(new NumericTimeDataPoint(DateTime.Today.AddDays(1), 35, "test2", false));series2.Points.Add(new NumericTimeDataPoint(DateTime.Today.AddDays(2), 40, "test2", false));series2.Points.Add(new NumericTimeDataPoint(DateTime.Today.AddDays(3), 15, "test2", false));myColumnLayer2.Series.Add(series2);
If so, maybe you should exclude your series from the Layer. For example:
myColumnLayer2.Series.Remove(series2);
Could you please upload small sample with your scenario. I`ll be glad to research it for you. Let me know if you have any questions.
Regards
I am talking about the series itself, each time I am running my macro the series "keep" the previous data and I have two graph instead of one.
It is hard to it describe here is a sample of my scenario :
ChartArea area = new ChartArea(); this.ChartAlphaRealized.CompositeChart.ChartAreas.Add(area); // make a transparent color //PaintElement pe = new PaintElement(Color.LightGreen); //PaintElement pe_red = new PaintElement(Color.Red); //PaintElement pe_blue= new PaintElement(Color.Blue); PaintElement pe = new PaintElement(Color.LightGreen); pe.Fill = Color.White; PaintElement pe_red = new PaintElement(Color.Purple); PaintElement pe_blue = new PaintElement(Color.Blue); //column layers use a string, GroupBySeries x axis AxisItem columnXAxis = new AxisItem(ChartAlphaRealized, AxisNumber.X_Axis); columnXAxis.DataType = AxisDataType.String; columnXAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries; columnXAxis.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel; columnXAxis.Labels.SeriesLabels.Format = AxisSeriesLabelFormat.SeriesLabel; columnXAxis.MajorGridLines.Visible = false; columnXAxis.Visible = false; area.Axes.Add(columnXAxis); //line layers use a string, ContinuousData x axis AxisItem lineXAxis = new AxisItem(ChartAlphaRealized, AxisNumber.X_Axis); lineXAxis.DataType = AxisDataType.String; lineXAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.ContinuousData; lineXAxis.MajorGridLines.Visible = false; lineXAxis.Labels.ItemFormat = AxisItemLabelFormat.Custom; lineXAxis.Labels.ItemFormatString = "<ITEM_LABEL>"; lineXAxis.Labels.SeriesLabels.Format = AxisSeriesLabelFormat.SeriesLabel; area.Axes.Add(lineXAxis); //the layers can share the numeric y axis. AxisItem YAxis = new AxisItem(ChartAlphaRealized, AxisNumber.Y_Axis); YAxis.DataType = AxisDataType.Numeric; YAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue; YAxis.MajorGridLines.Visible = false; YAxis.RangeType = AxisRangeType.Custom; YAxis.RangeMax = MAxAlphaCumulValue; YAxis.RangeMin = MinAlphaCumulValue; area.Axes.Add(YAxis); //the layers can share the numeric y axis. AxisItem YAxis2 = new AxisItem(ChartAlphaRealized, AxisNumber.Y2_Axis); YAxis2.DataType = AxisDataType.Numeric; YAxis2.Labels.ItemFormat = AxisItemLabelFormat.DataValue; YAxis2.MajorGridLines.Visible = false; YAxis2.RangeType = AxisRangeType.Custom; YAxis2.LineColor = Color.LightGreen; YAxis2.RangeMax = Convert.ToDouble(VolumeNumeric.Compute("MAX(Volume_rate)", "")) * 1.1; area.Axes.Add(YAxis2); //Other possible approach for DataBinding VolumeNumeric = removecfd.AddMissingDaysVolume(VolumeNumeric); VolumeNumeric = removecfd.SortMydt(VolumeNumeric, "DATE ASC"); // place a fake volume at the first row of volume DataRow VolRow = VolumeNumeric.NewRow(); VolRow["Volume_rate"] = 0; VolumeNumeric.Rows.InsertAt(VolRow,0); VolumeNumeric = removecfd.DateToString(VolumeNumeric); VolumeNumeric = removecfd.killdoublevolume(VolumeNumeric); AlphaTable = removecfd.DateToString(AlphaTable); InitTable = removecfd.DateToString(InitTable); VWAP_st_Table = removecfd.DateToString(VWAP_st_Table); PC_st_Table = removecfd.DateToString(PC_st_Table); SectorTable = removecfd.DateToString(SectorTable); VWAP_sector_Table = removecfd.DateToString(VWAP_sector_Table); PC_sector_Table = removecfd.DateToString(PC_sector_Table); SectorPriceTraded = removecfd.DateToString(SectorPriceTraded); VolumeNum = removecfd.CreateSeries(VolumeNum, VolumeNumeric, "DateS", "Volume_rate", pe); ChartAlphaRealized.CompositeChart.Series.Add(VolumeNum); AlphaReal_st = removecfd.CreateSeries(AlphaReal_st, AlphaTable, "DateS", "Alpha_partial", pe_red); ChartAlphaRealized.CompositeChart.Series.Add(AlphaReal_st); seriesInit = removecfd.CreateSeries(seriesInit, InitTable, "DateS", "Alpha_Since_Approval", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(seriesInit); VWAP_St = removecfd.CreateSeries(VWAP_St, VWAP_st_Table, "DateS", "VWAP_Real", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(VWAP_St); ClosedPrice_St = removecfd.CreateSeries(ClosedPrice_St, PC_st_Table, "DateS", "Closed price Vs E300", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(ClosedPrice_St); seriesInit_Sector = removecfd.CreateSeries(seriesInit_Sector, SectorTable, "DateS", "Init Sector", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(seriesInit_Sector); VWAP_Sector = removecfd.CreateSeries(VWAP_Sector, VWAP_sector_Table, "DateS", "VWAP Vs Sector", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(VWAP_Sector); ClosedPrice_Sector = removecfd.CreateSeries(ClosedPrice_Sector, PC_sector_Table, "DateS", "Closed price Vs Sector", pe_blue); ChartAlphaRealized.CompositeChart.Series.Add(ClosedPrice_Sector); TradedPrice_Sector = removecfd.CreateSeries(TradedPrice_Sector, SectorPriceTraded, "DateS", "Sectors", pe_red); ChartAlphaRealized.CompositeChart.Series.Add(TradedPrice_Sector); ChartLayerAppearance columnLayer = new ChartLayerAppearance(); columnLayer.AxisX = columnXAxis; columnLayer.AxisY = YAxis2; columnLayer.ChartArea = area; columnLayer.ChartType = ChartType.ColumnChart; columnLayer.Series.Add(VolumeNum); columnLayer.SwapRowsAndColumns = true; ChartAlphaRealized.CompositeChart.ChartLayers.Add(columnLayer); ChartLayerAppearance lineLayer = new ChartLayerAppearance(); lineLayer.AxisX = lineXAxis; lineLayer.AxisY = YAxis; lineLayer.ChartArea = area; lineLayer.ChartType = ChartType.SplineChart; lineLayer.Series.Add(AlphaReal_st); lineLayer.Series.Add(seriesInit); lineLayer.Series.Add(VWAP_St); lineLayer.Series.Add(ClosedPrice_St); lineLayer.Series.Add(VWAP_Sector); lineLayer.Series.Add(ClosedPrice_Sector); lineLayer.Series.Add(TradedPrice_Sector); lineLayer.Series.Add(seriesInit_Sector); ChartAlphaRealized.CompositeChart.ChartLayers.Add(lineLayer); TradedPrice_Sector.Visible = false;
thanks
Thanks for the code above all. It seems to be correct. Are you using your UltraChart`s designer for something ? Are you able to upload whole sample. I`d like to run and debug your sample. Are you able to capture a video which include application building and run time behavior ?