using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hippo;
namespace WindowsHippoTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Draw();
}
Rectangle rec;
private void Draw()
{
SeriesList sList = new SeriesList();
sList.ChartType = ChartType.BoxPlot;
sList.Transparency = 55;
Random r = new Random();
for(int i = 0; i < 1; i++)
{
Series sr = new Series();
//sr.BoxPlotsAttributes.IsShowFigureText = true;
for(int x = 0; x < 12; x++)
{
SeriesItem item = new SeriesItem();
item.GroupName = "G2";
item.Name = "item" + x.ToString();
item.YValue = r.Next(5, 700);
sr.items.Add(item);
}
for(int x = 0; x < 14; x++)
{
SeriesItem item = new SeriesItem();
item.GroupName = "G3";
item.Name = "item" + x.ToString();
item.YValue = r.Next(5, 700);
if (x > 10) item.YValue = r.Next(800, 1100);
sr.items.Add(item);
}
for(int x = 0; x < 9; x++)
{
SeriesItem item = new SeriesItem();
item.GroupName = "G4";
item.Name = "item" + x.ToString();
item.YValue = r.Next(5, 700);
sr.items.Add(item);
}
sList.SeriesCollection.Add(sr);
}
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();
}
private void hHippoChart1_ChartMouseDoubleClick(object sender, MouseEventArgs e)
{
this.hHippoChart1.SeriesListDictionary.Clear();
Draw();
}
private void hHippoChart1_ChartMouseMove_1(object sender, MouseEventArgs e)
{
for(int i = 0; i < this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList.Count; i++)
{
PointF firstpoint = this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].FigurePoint;
float lastPoX = (float)(firstpoint.X + this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].Column.Width);
float lastPoY = (float)(firstpoint.Y + this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].Q3 - this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].Q1);
PointF lastPoint = new PointF(lastPoX, lastPoY);
if (e.X >= firstpoint.X && e.X <= lastPoint.X && e.Y >= firstpoint.Y && e.Y <= lastPoint.Y)
{
this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].IsShowFigureText = true;
}
else
{
this.hHippoChart1.SeriesListDictionary[0].SeriesCollection[0].BoxPlotList[i].IsShowFigureText = false;
}
}
this.hHippoChart1.DrawChart();
}
}
}
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Hippo
Namespace WindowsHippoTest
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs)
Draw()
End Sub
Private rec As Rectangle
Private Sub Draw()
Dim sList As New. SeriesList()
sList.ChartType = ChartType.BoxPlot
sList.Transparency = 55
Dim r As New. Random()
For i As Integer = 0 To 0
Dim sr As New. Series()
`sr.BoxPlotsAttributes.IsShowFigureText = true;
For x As Integer = 0 To 11
Dim item As New. SeriesItem()
item.GroupName = "G2"
item.Name = "item" & x.ToString()
item.YValue = r.[Next](5, 700)
sr.items.Add(item)
Next
For x As Integer = 0 To 13
Dim item As New. SeriesItem()
item.GroupName = "G3"
item.Name = "item" & x.ToString()
item.YValue = r.[Next](5, 700)
If x > 10 Then
item.YValue = r.[Next](800, 1100)
End If
sr.items.Add(item)
Next
For x As Integer = 0 To 8
Dim item As New. SeriesItem()
item.GroupName = "G4"
item.Name = "item" & x.ToString()
item.YValue = r.[Next](5, 700)
sr.items.Add(item)
Next
sList.SeriesCollection.Add(sr)
Next
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()
End Sub
Private Sub hHippoChart1_ChartMouseDoubleClick(sender As Object, e As MouseEventArgs)
Me.hHippoChart1.SeriesListDictionary.Clear()
Draw()
End Sub
Private Sub hHippoChart1_ChartMouseMove_1(sender As Object, e As MouseEventArgs)
For i As Integer = 0 To Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList.Count - 1
Dim firstpoint As PointF = Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).FigurePoint
Dim lastPoX As Single = CSng(firstpoint.X + Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).Column.Width)
Dim lastPoY As Single = CSng(firstpoint.Y + Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).Q3 - Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).Q1)
Dim lastPoint As New. PointF(lastPoX, lastPoY)
If e.X >= firstpoint.X AndAlso e.X <= lastPoint.X AndAlso e.Y >= firstpoint.Y AndAlso e.Y <= lastPoint.Y Then
Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).IsShowFigureText = True
Else
Me.hHippoChart1.SeriesListDictionary(0).SeriesCollection(0).BoxPlotList(i).IsShowFigureText = False
End If
Next
Me.hHippoChart1.DrawChart()
End Sub
End Class
End Namespace