Is it possible to hide plotting data point marker on mschart ??
hi,please help,Is it possible to hide plotting data point on mschart ,if the data point is below the minimum scale Y from the mschart than the plotting data point marker will hide,if the data point is in the Y scare then the data point marker will show.
for example:
scale Y minimum = 25
data plotting point = -1
if the data plotting point is -1 and the scale Y minimum =25,if this situation data marker point will hide.
Re: Is it possible to hide plotting data point marker on mschart ??
hack,
i try to use this method.but cannot get the result.
i try this method:
Code:
If Rss!seven < Text1.Text Then
ArrayChart(X, 5) = vbNull
Else
ArrayChart(X, 5) = Rss!seven
End If
this is the current plot data point
Code:
Con.Open "driver={SQL Server};Server=ERP_server;Uid=sa;pwd=sa;database=SPC"
Set Rss = Nothing
Rss.Open " Select sum(sampleno/5)as subgroup,avg(data)as avgdata ,avg(sevenpoint)as seven, time,date from spcdata where date between '" & Format$(startdate, "yyyy-mm-dd") & "' and '" & Format$(enddate, "yyyy-mm-dd") & "' and partno ='" & partno & "'and dimension = '" & dimension & "' and machineno ='" & machineno & "'group by date,time", Con, adOpenKeyset ' Making Recordset
rs1.Open "SELECT PartNo, Dimension,Nominal, UCL, LCL From PartList WHERE PartNo = '" & partno & "' AND Dimension = '" & dimension & "' ", Con, adOpenKeyset ' Making Recordset
If Rss.RecordCount = 0 Then ' If no Record in Database, then Show an Error Msg and Exit the Sub
Else
ReDim ArrayChart(1 To Rss.RecordCount, 1 To 5) ' Array
For X = 1 To Rss.RecordCount
ArrayChart(X, 1) = Rss!avgdata
ArrayChart(X, 2) = rs1!ucl
ArrayChart(X, 3) = rs1!lcl
ArrayChart(X, 4) = (rs1!lcl + rs1!ucl) / 2
ArrayChart(X, 5) = Rss!seven
Rss.MoveNext
Next X
' 'Set manually the setting of the Scale of Axis
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = (rs1!ucl) + (0.2 * ((rs1!ucl) - (rs1!lcl)))
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = (rs1!lcl) - (0.2 * ((rs1!ucl) - (rs1!lcl)))
text1.text = MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Minimum
'# Assigns array to the MSChart control #
MSChart1.ChartData = ArrayChart
MSChart1.SeriesType = VtChSeriesType2dLine
MSChart1.Refresh
End If
With MSChart1.Plot.SeriesCollection(1)
.SeriesMarker.Auto = False
.DataPoints.Item(-1).Marker.Visible = True
.DataPoints.Item(-1).Marker.Size = 65
.DataPoints.Item(-1).Marker.Style = VtMarkerStyleSquare
End With
With MSChart1.Plot.SeriesCollection(5)
.SeriesMarker.Auto = False
.DataPoints.Item(-1).Marker.Visible = True
.DataPoints.Item(-1).Marker.Size = 65
.DataPoints.Item(-1).Marker.Style = VtMarkerStyleSquare
End With
Set Rss = Nothing
Set rs1 = Nothing
End Sub
Last edited by gracehskuo; Jun 18th, 2008 at 01:24 AM.
Re: Is it possible to hide plotting data point marker on mschart ??
hack,
hi, i create another sql query to data not to plot below the present minimum.but than i face another problem.when i try to plot the unwanted data point it become a line chart.rs2!seven is the sql query not to plot below the present minimum.
this is the current code:
Code:
Rss.Open " Select sum(sampleno/5)as subgroup,avg(data)as avgdata , time,date from spcdata where date between '" & Format$(startdate, "yyyy-mm-dd") & "' and '" & Format$(enddate, "yyyy-mm-dd") & "' and partno ='" & partno & "'and dimension = '" & dimension & "' and machineno ='" & machineno & "' group by date,time", Con, adOpenKeyset ' Making Recordset
rs1.Open "SELECT PartNo, Dimension,Nominal, UCL, LCL From PartList WHERE PartNo = '" & partno & "' AND Dimension = '" & dimension & "' ", Con, adOpenKeyset ' Making Recordse
rs2.Open " Select sum(sampleno/5)as subgroup,avg(data)as avgdata ,avg(sevenpoint)as seven, time,date from spcdata where date between '" & Format$(startdate, "yyyy-mm-dd") & "' and '" & Format$(enddate, "yyyy-mm-dd") & "' and partno ='" & partno & "'and dimension = '" & dimension & "' and machineno ='" & machineno & "'and sevenpoint <>-99999 group by date,time", Con, adOpenKeyset ' Making Recordset
If Rss.RecordCount = 0 Then ' If no Record in Database, then Show an Error Msg and Exit the Sub
' MsgBox "No Data to Show on Chart!!!", vbCritical, "MSChart Demo": Exit Sub
Else
ReDim ArrayChart(1 To Rss.RecordCount, 1 To 5) ' Array
'Puuting Records from Database to Array
For X = 1 To Rss.RecordCount
ArrayChart(X, 1) = Rss!avgdata
ArrayChart(X, 2) = rs1!ucl
ArrayChart(X, 3) = rs1!lcl
ArrayChart(X, 4) = (rs1!lcl + rs1!ucl) / 2
ArrayChart(X, 5) = rs2!seven
Rss.MoveNext
Next X