Ejemplo n.º 1
0
        private static void DoSelection(RadHeatMap heatMap, HeatMapCellDataPoint hoveredDataPoint)
        {
            if (clickedDataPoint == null || hoveredDataPoint == null)
            {
                return;
            }

            int startRowIndex = Math.Min(clickedDataPoint.RowIndex, hoveredDataPoint.RowIndex);
            int endRowIndex = Math.Max(clickedDataPoint.RowIndex, hoveredDataPoint.RowIndex);
            int startColumnIndex = Math.Min(clickedDataPoint.ColumnIndex, hoveredDataPoint.ColumnIndex);
            int endColumnIndex = Math.Max(clickedDataPoint.ColumnIndex, hoveredDataPoint.ColumnIndex);

            var cDefinition = heatMap.Definition as CategoricalDefinition;
            if (cDefinition != null)
            {
                DoSelection(cDefinition, startRowIndex, endRowIndex, startColumnIndex, endColumnIndex);
            }
            var hDefinition = heatMap.Definition as HorizontalDefinition;
            if (hDefinition != null)
            {
                DoSelection(hDefinition, startRowIndex, endRowIndex);
            }
            var vDefinition = heatMap.Definition as VerticalDefinition;
            if (vDefinition != null)
            {
                DoSelection(vDefinition, startColumnIndex, endColumnIndex);
            }
        }
Ejemplo n.º 2
0
        private static void DoSelection(RadHeatMap heatMap, HeatMapCellDataPoint hoveredDataPoint)
        {
            if (clickedDataPoint == null || hoveredDataPoint == null)
            {
                return;
            }

            int startRowIndex    = Math.Min(clickedDataPoint.RowIndex, hoveredDataPoint.RowIndex);
            int endRowIndex      = Math.Max(clickedDataPoint.RowIndex, hoveredDataPoint.RowIndex);
            int startColumnIndex = Math.Min(clickedDataPoint.ColumnIndex, hoveredDataPoint.ColumnIndex);
            int endColumnIndex   = Math.Max(clickedDataPoint.ColumnIndex, hoveredDataPoint.ColumnIndex);

            var cDefinition = heatMap.Definition as CategoricalDefinition;

            if (cDefinition != null)
            {
                DoSelection(cDefinition, startRowIndex, endRowIndex, startColumnIndex, endColumnIndex);
            }
            var hDefinition = heatMap.Definition as HorizontalDefinition;

            if (hDefinition != null)
            {
                DoSelection(hDefinition, startRowIndex, endRowIndex);
            }
            var vDefinition = heatMap.Definition as VerticalDefinition;

            if (vDefinition != null)
            {
                DoSelection(vDefinition, startColumnIndex, endColumnIndex);
            }
        }
Ejemplo n.º 3
0
 private static void Heatmap_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     DoSelection(lastHoveredDataPoint);
     selectionRectangle.Visibility = Visibility.Collapsed;
     clickedDataPoint     = null;
     lastHoveredDataPoint = null;
     currentHeatmap       = null;
 }
Ejemplo n.º 4
0
        private static void EnsureSelectionRectangleVisualParent(RadHeatMap heatmap)
        {
            var newParentGrid = Telerik.Windows.Controls.ChildrenOfTypeExtensions.ChildrenOfType <Grid>(heatmap).First();
            var oldParentGrid = selectionRectangleHost.Parent as Grid;

            if (oldParentGrid != newParentGrid && oldParentGrid != null)
            {
                oldParentGrid.Children.Remove(selectionRectangleHost);
            }
            if (oldParentGrid != newParentGrid)
            {
                newParentGrid.Children.Add(selectionRectangleHost);
            }
        }
Ejemplo n.º 5
0
        private static void Heatmap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            currentHeatmap = (RadHeatMap)sender;
            if (currentHeatmap.HoveredCellDataPoint == null)
            {
                return;
            }

            EnsureSelectionRectangleVisualParent();
            selectionRectangle.Visibility = Visibility.Visible;
            selectionRectangle.Width = 0;
            selectionRectangle.Height = 0;

            var pos = e.GetPosition(currentHeatmap);
            clickedX = pos.X;
            clickedY = pos.Y;
            clickedDataPoint = currentHeatmap.HoveredCellDataPoint;
            lastHoveredDataPoint = clickedDataPoint;
        }
Ejemplo n.º 6
0
        private static void Heatmap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            currentHeatmap = (RadHeatMap)sender;
            if (currentHeatmap.HoveredCellDataPoint == null)
            {
                return;
            }

            EnsureSelectionRectangleVisualParent();
            selectionRectangle.Visibility = Visibility.Visible;
            selectionRectangle.Width      = 0;
            selectionRectangle.Height     = 0;

            var pos = e.GetPosition(currentHeatmap);

            clickedX             = pos.X;
            clickedY             = pos.Y;
            clickedDataPoint     = currentHeatmap.HoveredCellDataPoint;
            lastHoveredDataPoint = clickedDataPoint;
        }
Ejemplo n.º 7
0
 private static void EnsureSelectionRectangleVisualParent(RadHeatMap heatmap)
 {
     var newParentGrid = Telerik.Windows.Controls.ChildrenOfTypeExtensions.ChildrenOfType<Grid>(heatmap).First();
     var oldParentGrid = selectionRectangleHost.Parent as Grid;
     if (oldParentGrid != newParentGrid && oldParentGrid != null)
     {
         oldParentGrid.Children.Remove(selectionRectangleHost);
     }
     if (oldParentGrid != newParentGrid)
     {
         newParentGrid.Children.Add(selectionRectangleHost);
     }
 }
Ejemplo n.º 8
0
 private static void Heatmap_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     DoSelection(lastHoveredDataPoint);
     selectionRectangle.Visibility = Visibility.Collapsed;
     clickedDataPoint = null;
     lastHoveredDataPoint = null;
     currentHeatmap = null;
 }