You are on page 1of 4
Chart Activate Cast (ChartEvents Event) BeforeDoubleClick BeforeRightclick Calculate Deactivate MouseDown Description 365 19 16 13 10 07 Occurs when an yoyryyyy embedded chart or chart object on a chart sheets selected, This should be used instead ofthe OnSheetActivate property Occurs before an yoyryyyy embedded chart or chart object on a chart sheet i double clicked. This should be used instead ofthe ‘OnDoubleclick property Occurs before an yoryyyy embedded char or chart object on a chart sheets right clicked, Occurs before arynew YY Y YY ¥ datas plotted er data changes. ‘This ie rized on a chart sheet that was updated because data it references changed This event does nat occur until the charts forced to redraw. So if the chart is not currently visible because itis not selected or displayed in its own window the event wll not be raised until the charts visible Ocarswhenanew = Y OY Y YoY ¥ embedded char or chart shoots activate and another embeded chart, chart sheet or worksheet is selected. ‘This should be used instead ofthe ‘OnsheetDenctivate property Occurswhen amuse Y Y Y YY ¥ button is pressed while the pointer is over an embedded char or chart sheet wa MouseMove Occursiwhen the mouse Y OY Y YY ¥ pointe is moved ever the chart MouseUp Occurs when amouse YY Y YY ¥ button is released while the pointer is over ah embedded chart or chart shoot Resize Occurswhen achaetis YoY Y YY ¥ resizes select Occurswhen achat = Y oY Y YY ¥ ‘Cast (ChatEvents Event clement is selected Raised when the selected element within chart sheet changes, ‘The combination of the three parameters allows you to determine exactly what element is selected. SeriesChange Ocaurswhenavaleof Y oY Y YY ¥ chart data point changes Writing Chart Events ‘This object does nat have events enabled by defaul You must write your own event handler routines when you want to capture chart events for embeded charts Ifyou want to capture the chart events fra specific chart sheet the event handlers are available in an identical way to the worksheet level events. ‘Te advantage of this method is that you can run the same event hanler for different chart objects Public witnevents ExcalchartEvents As Chart Sot chart bucelthartévents = Korksheets(2).charsongects(2) chars set charta.becelchartfvents = Korksheets(1) .charsopsects(2) chart Embedded Chart Events ‘Add a class modile to trap the events [Add a standard module to hook the event handler ta your charts ‘The exact code will depend on your situation but there are a wide range of eifferent scenarios ‘rom all charts in al sheets in all workbooks to just a single chart ina specific workbook Chart Select Event ‘Oryou can use a Chart object declare in a class module to write an event handler for both ‘embedded chars and chart sheets This event has three arguments passed to it 24 ElementID -Idenifies the char {Argt - provides addtional informs lement (Icha sm) enumeration irorBars Seresinex ikErrorBars Seresindex aiverroBars Seresindex aiegendéney Seresindex ailegencey Seresindex apBars Grouplndex iDowndars Groupindex iSeresLines Grouplndex aiivotines Grouplndex xIDropLines Groupindex iRadarAvisLabels —_Groupindex shape Shapeindex xPivotChartDrepzone DropZoneType ‘Arg2 - provides adltiona informati iSeries Seriesinex Pointndex iDatalabo Seriesindex Pointindex airenduine Seriesindex “Trendtineincex iis aisindex AuisType iMajorGrenes aisindex eistype iMinorGriines——_Axsindex niistype asin aisndex iistype xlbisplayUnitLabel ——_Axisndex AuisType aPivotChartFeldButton DropZoneType PvotFendex Chart MouseUp Event This event has four arguments passed tot Button - Identifies which button was released (IMouseButon) Shift Kentifiesf any other keys were pressed (Ca Shit, A) x Identifies the x-coordnate Y¥ Identifies the y-coordinate Change Events Change events are typically raised when a user exist cll eat mode by leaving the cll or pressing Enter Change events can also be raised when a cells inked to external data andit changes as 2 result of refreshing the external dat ‘Change events are not ase asa result of recalculation ApplcatonSheetChange Workbooksheetchange Worksheet. change Event Procedures aa private private Private Sub chart Activatet) Sub Chart_seforeooubleciick( sya ElenantTD As Longe — ByVal APBL AS Longs _ Val APER AS Longs — ayer Cancel As Goolsan) Sub Chart_eforeRightCliek(2yter Cancels Sootean) Sub Chart_caleuate() Sub Chart_peactivate() Sub Chart Mousedown(yV1 Button As Loney — fyval SAFE AS Loney = Byial x As Longs _ Byval y As Long) Sub Chart Mousove(yVa Button AS Longs — byvat SEFC AG Loney = Byval x As Longs = fyval y A Long) Sub Chart Mouseup(syval Button As Longs — yal Saft As Long, — ysl y As Long) Sub Chart_Restze() Sub Chart selece(ayval EleneatIO £5 Long, syval Argh AS Longs = eyval arg2 As Long) Sub Chart_sentescnange(oyal Serdestndex A Longs — ‘5yval Potntzndex As Lone) (© 2021 Beter Solutions Limited, AlLRights Reserve, aa

You might also like