Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
dear coder friends
i am using microsoft chart with vb2008 to plot some data as a spline. my data plots correctly but i get an unwanted line joining the first and last points. I want to remove the line. can anyone help me with this?
with best wishes
10118655

the vb code to generate data
VB
Public Sub Plot31in()
'Depth1 is X axis, SP1 is Y axis
'Chart31in is name of the form
'Chart1 is the MS Chart object
    Chart31in.Chart1.Series("SP").Points.DataBindXY(Depth1, SP1)
     For i As Long = IndexProcTop To IndexProcBot
        Chart31in.Chart1.Series("SP").Points.AddXY(Depth1(i), SP1(i))
    Next
End Sub


Unable to add the screenshot here, can someone tell me how to do that ?
Posted
Updated 5-Aug-13 19:21pm
v2
Comments
Maciej Los 5-Aug-13 2:33am    
Please, be more specific and provide more details. We can't read in your mind and we don't see your monitor...
I think, you need to check method which generates chart.
Member 10118655 6-Aug-13 1:24am    
thanks for looking at my question. could you please tell me how to add the screen shot. i tried copy and paste on the ver.2, but it didnt work.
Maciej Los 6-Aug-13 1:35am    
You can't add image. Please, describe your problem as much as you can.
Member 10118655 6-Aug-13 5:17am    
the data (x,y points) are plotted correctly on the chart object. I am plotting the data as spline. All OK so far. However, an additional straight line is also drawn starting from last x,y point to the first x,y point (sort of loop back). I want to remove this straight line joining the last point to the first point. thanks again.
Maciej Los 6-Aug-13 6:22am    
Try to change chart type.
Chart controls[^]
Using Chart Controls[^]

1 solution

Got the answer myself : inserted 'clear' statement. here's the new code :

VB
Chart31in.Chart1.Series("SP").Points.DataBindXY(Depth1, SP1)

Chart31in.Chart1.Series("SP").Points.Clear()

For i As Long = IndexProcTop To IndexProcBot
    Chart31in.Chart1.Series("SP").Points.AddXY(Depth1(i), SP1(i))
Next


Thanks for looking at my question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900