private void checkedListBoxBodyParts_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            SkeletonJoint changedJoint = JointDictionary.GetTranslation((String)checkedListBoxBodyParts.Items[e.Index]).joint_type;

            chartErrors.Series[(String)checkedListBoxBodyParts.Items[e.Index]].Enabled = (e.NewValue == CheckState.Checked);
            foreach (Annotation annotation in annotations[changedJoint])
            {
                annotation.Visible = e.NewValue == CheckState.Checked;
            }

            if (activeJoints.Contains(changedJoint))
            {
                if (e.NewValue != CheckState.Checked)
                {
                    activeJoints.Remove(changedJoint);
                }
            }
            else
            {
                if (e.NewValue == CheckState.Checked)
                {
                    activeJoints.Add(changedJoint);
                }
            }

            OpenNIRecordingController video = (videoDataSource.Source as OpenNIRecordingController);

            if (video != null)
            {
                statistics.Calculate(getActiveJoints(),
                                     (double)mediaSliderConfidenceThreshold.Value * mediaSliderValueFactor,
                                     false, video.CurrentFrame);
            }
        }
        private void clearErrorPoints()
        {
            foreach (Series series in chartErrors.Series)
            {
                series.Points.Clear();

                List <Annotation> remove_list = annotations[JointDictionary.GetTranslation(series.Name).joint_type];
                foreach (Annotation annotation in remove_list)
                {
                    chartErrors.Annotations.Remove(annotation);
                    annotation.Dispose();
                }
                remove_list.Clear();
            }
        }
        private void addErrorPoint(SkeletonJoint series, int x, double y, Statistics.MarkerType markerType)
        {
            String    seriesName = JointDictionary.GetTranslation(series).name;
            DataPoint newPoint   = new DataPoint(x, y);

            if (markerType == Statistics.MarkerType.FalseNegative)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorFalsePositive;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.FalsePositive)
            {
                RectangleAnnotation marker = new RectangleAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorFalseNegative;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.NotAvailable)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorNA;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            Series insertionSeries = chartErrors.Series[seriesName];
            int    insertion_index = 0;

            for (int index = 0; index < insertionSeries.Points.Count; index++)
            {
                if (insertionSeries.Points[index].XValue > x)
                {
                    break;
                }
                else
                {
                    insertion_index++;
                }
            }

            chartErrors.Series[seriesName].Points.Insert(insertion_index, newPoint);
        }