I am using a line chart. Its working well. However I am running into a bit of a challenge. Perhaps someone can help? See the image below. See how the lines drop? Thats because these weeks have no data yet. I want the line to end when the 0s begin. I know this cant be accross the board for all 0s or we would have bigger issues, but there has to be a way to control how the lines are drawn right?
Hi,
You could use the ChartDrawItem event of the chart and remove the unnecessary points of the polyline which have 0s. The following example removes the last points from all polylines:
protected void Page_Load(object sender, EventArgs e){ UltraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart; UltraChart1.ChartDrawItem += new Infragistics.UltraChart.Shared.Events.ChartDrawItemEventHandler(UltraChart1_ChartDrawItem); UltraChart1.DataSource = DemoTable.Table(); UltraChart1.DataBind();}void UltraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e){ if (e.HasData) { if (e.Primitive is Polyline) { Polyline pl = e.Primitive as Polyline; //check to see for the propriate polyline datavalue.... DataPoint[] newPoints = new DataPoint[pl.points.Length - 1]; //create new points collection with less points for (int k = 0; k < newPoints.Length; k++) { newPoints[k] = pl.points[k]; } pl.points = newPoints; //change the points collection of the polyline } }}
I will try that thank you!