Click here to Skip to main content
15,887,214 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: File System Library Pin
Henry Minute25-Sep-09 2:22
Henry Minute25-Sep-09 2:22 
AnswerRe: File System Library Pin
cmk25-Sep-09 6:24
cmk25-Sep-09 6:24 
AnswerRe: File System Library Pin
PIEBALDconsult26-Sep-09 4:44
mvePIEBALDconsult26-Sep-09 4:44 
GeneralRe: File System Library Pin
Najeeb Shaikh28-Sep-09 19:23
Najeeb Shaikh28-Sep-09 19:23 
AnswerRe: File System Library Pin
AlliedBits8-May-10 3:19
AlliedBits8-May-10 3:19 
GeneralRe: File System Library Pin
Najeeb Shaikh10-May-10 1:51
Najeeb Shaikh10-May-10 1:51 
Questionsir pls help me Pin
rashid200923-Sep-09 18:32
rashid200923-Sep-09 18:32 
QuestionHowto React on OWC11 Clicks on Bar-chart Solution Pin
RüdiActivity23-Sep-09 3:56
RüdiActivity23-Sep-09 3:56 
Keywords: Office Web Components 11, events, VB.NET.

I have seen that several persons on the internet requesting a solution for this, so here comes my solution that works with VS2005 and 2008:

The requirement is to be able to click a single bar in a OWC chart and then treat the information about this event in code. My simple example changes the color of the bar that is clicked; but this can easily be extended to more complex computation like e.g. database queries upon user selection, or editing etc. and serve for real user interactivity.

Do this:
Create a new project with a user form. Add the OWC11 charts to you toolbox and drag a chart onto the form. Open the code for the form.

Imports OWC11 = Microsoft.Office.Interop.Owc11


Create a local variable for the chart and add the form loader.

    Public Class Form1
Private m_Chart As OWC11.ChChart

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        m_Chart = AxChartSpace1.Charts.Add
        Dim oSer As OWC11.ChSeries = m_Chart.SeriesCollection.Add
        Dim aCats As Object() = New Object() {"A", "B", "C"}
        Dim aVals As Object() = New Object() {100, 120, 128}
        oSer.SetData(OWC11.ChartDimensionsEnum.chDimSeriesNames, -1, "MySeries")
        oSer.SetData(OWC11.ChartDimensionsEnum.chDimCategories, -1, aCats)
        oSer.SetData(OWC11.ChartDimensionsEnum.chDimValues, -1, aVals)
    End Sub


The next is the action upon a mouse click on the chart.

Private Sub AxChartSpace1_ClickEvent(ByVal sender As Object, ByVal _
   e As System.EventArgs) _
   Handles AxChartSpace1.ClickEvent

     Debug.WriteLine(Now & " click")

     Dim mousePoint As Point = AxChartSpace1.PointToClient(MousePosition)

     Dim oSer As OWC11.ChSeries = m_Chart.SeriesCollection(0)
     Dim i As Integer
     For i = 0 To oSer.Points.Count - 1

         Dim le = oSer.Points(i).Left
         Dim ri = oSer.Points(i).Right
         Dim hi = oSer.Points(i).Top
         Dim lo = oSer.Points(i).Bottom

         If mousePoint.X > le And mousePoint.X < ri Then
             m_Chart.SeriesCollection(0).Points(i).Interior.Color = RGB(100, 100, 100)
         Else
             m_Chart.SeriesCollection(0).Points(i).Interior.Color = RGB(0, 0, 200)
         End If

     Next

 End Sub


Once we know which column is selected we can do more (not shown here).

Be aware that there is a MS license agreement for treating events in OWC, which might be applicable here.

Hope this helps somebody.

R. CodeHamster
Questionnetwork lan card status Pin
rashid200922-Sep-09 17:33
rashid200922-Sep-09 17:33 
AnswerRe: network lan card status Pin
Luc Pattyn22-Sep-09 23:42
sitebuilderLuc Pattyn22-Sep-09 23:42 
AnswerRe: network lan card status Pin
Blikkies23-Sep-09 1:17
professionalBlikkies23-Sep-09 1:17 
GeneralRe: network lan card status Pin
Luc Pattyn23-Sep-09 1:34
sitebuilderLuc Pattyn23-Sep-09 1:34 
QuestionIs it possible to have both row and column selection set in DataGridView? Pin
John Mauer22-Sep-09 5:31
John Mauer22-Sep-09 5:31 
AnswerRe: Is it possible to have both row and column selection set in DataGridView? Pin
Dave Kreskowiak22-Sep-09 6:29
mveDave Kreskowiak22-Sep-09 6:29 
GeneralRe: Is it possible to have both row and column selection set in DataGridView? Pin
John Mauer22-Sep-09 9:38
John Mauer22-Sep-09 9:38 
AnswerRe: Is it possible to have both row and column selection set in DataGridView? Pin
PIEBALDconsult24-Sep-09 17:24
mvePIEBALDconsult24-Sep-09 17:24 
GeneralRe: Is it possible to have both row and column selection set in DataGridView? Pin
John Mauer25-Sep-09 1:10
John Mauer25-Sep-09 1:10 
QuestionUnable to find the version of runtime to run this application Pin
AmolKumbhar21-Sep-09 23:37
AmolKumbhar21-Sep-09 23:37 
AnswerRe: Unable to find the version of runtime to run this application Pin
Ravi Mori22-Sep-09 23:59
Ravi Mori22-Sep-09 23:59 
GeneralRe: Unable to find the version of runtime to run this application Pin
AmolKumbhar23-Sep-09 3:12
AmolKumbhar23-Sep-09 3:12 
Questionasp.menu not immediately reflecting DB changes. (C#) Pin
Timothy OBrien21-Sep-09 10:48
Timothy OBrien21-Sep-09 10:48 
AnswerRe: asp.menu not immediately reflecting DB changes. (C#) Pin
Ravi Mori21-Sep-09 20:52
Ravi Mori21-Sep-09 20:52 
QuestionCopy Past Outlook attachments Pin
bluepoison21-Sep-09 1:58
bluepoison21-Sep-09 1:58 
AnswerRe: Copy Past Outlook attachments Pin
Not Active21-Sep-09 2:23
mentorNot Active21-Sep-09 2:23 
AnswerRe: Copy Past Outlook attachments Pin
bluepoison21-Sep-09 2:32
bluepoison21-Sep-09 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.