On 22 Mag, 17:49, LordOfTh...@[EMAIL PROTECTED]
wrote:
> Perfectly understandable. You are slightly off-topic here but as I
> can't think of anywhere else to give a sartifactory answer, here we
> go...
>
> As previously suggested, box-plotting (AKA candlestick) is the
> appropriate technique for this problem. If the target audience is not
> statistically literate, a simplified version displaying min, max and
> mean (as opposed to quartiles and median) may be preferable; in such a
> case the data required per box could be:-
>
> {
> =A0 =A0float =A0 startTime, endTime;
> =A0 =A0float =A0 sampleMin, sampleMax, sampleTotal;
> =A0 =A0integer sampleCount;
>
> } Box;
>
> You would declare an array of boxes (any more than 128 boxes is likely
> to be a problem for clarity of display) and add one sample value to
> each box until the boxes are filled. Once all boxes are filled with
> the same number of samples, you must then merge pairs of adjacent
> boxes (thus doubling the number of samples per box and halving the
> number of boxes). Subsequent samples are then added to the next free
> box until it has the same number of samples as previous boxes; then
> move onto the next free box and so on. When the boxes are once again
> all filled with the same number of samples, merge pairs of adjacent
> boxes as before.
>
> Merging is a straightforward operation:
>
> mergedBox.startTime=3D MIN(box1.startTime, box2.startTime);
> mergedBox.endTime=3D MIN(box1.endTime, box2.endTime);
> mergedBox.sampleMin=3D MIN(box1.sampleMin, box2.sampleMin);
> mergedBox.endTime=3D MIN(box1.sampleMax, box2.sampleMax);
> mergedBox.sampleTotal=3D box1.sampleTotal + box2.sampleTotal;
> mergedBox.sampleCount=3D box1.sampleCount + box2.sampleCount;
>
> The complexity is all in managing the box data structures; using two
> lists (source and destination) for the merge process will help to make
> it more understandable. Should you require any help with lists, you
> definately should not request it from this group...
Thank you Lord, very kind and helpful of you
I will keep your suggestion in mind in case I am also asked to to
make the candlestick chart.
For now I have to stock wih the line chart.
By the way I have been revising the initial idea of removing odd-place
terms
by adding the device to do that "piecewise".
Doing that piecewise *is* needed because if I do not do it, then I
get several ****tions with different sampling rate, and the beginning
of the chart becomes smoother and smoother, until it become a line
[that's the previous attempt I have done and discarded]..
Doing it piecewise gives much more acceptable result. We still have
(at most) 2 sampling rates
simultaneously in the chart, but I bet if I do not tell you, your eye
does not notice it.
The difference between 1 second and 2 second rate, or 1 minute and 2
minute
is unnoticeable as the number of terms increase.
Here is the small procedure that I just wrote to do it and seems to
work fine. But it must be changed if
we assume that values are not equispaced or there can be interruptions
(and I can have interruptions).
So now I am looking to creating also a version which solve this second
problem.
Let me know in case of ideas on the best solution.
Sub KeepListUniformlyResampledWithinBound(ByRef MyList As List(Of
ObservedValue), _
ByVal ListCountBound As
Integer, _
ByRef ValuesProcessed As
Integer, _
ByVal PreservedMin As
Double, _
ByVal PreservedMax As
Double)
If MyList.Count < ListCountBound Then Exit Sub
'Resampling
Dim NumberOfRemovedItems As Integer
Dim NumberOfKeptItems As Integer
For i As Integer =3D MyList.Count - ValuesProcessed - 1 To 0
Step -1
Dim Value As Double =3D MyList(i).Value
If i Mod 2 =3D 1 AndAlso Value <> PreservedMin AndAlso Value
<> PreservedMax Then
MyList.RemoveAt(i)
NumberOfRemovedItems +=3D 1
Else
NumberOfKeptItems +=3D 1
End If
Next i
ValuesProcessed +=3D NumberOfKeptItems
If NumberOfRemovedItems <=3D 1 Then ValuesProcessed =3D 0
End Sub
Where, as said before, ObservedValue represents the pair Time, Value:
<Serializable()> Public Class ObservedValue
Sub New(ByVal Value As Double, ByVal Instant As Date)
Me.Value =3D Value
Me.Instant =3D Instant
End Sub
Public Value As Double
Public Instant As Date
End Class


|