+ Reply to Thread
Results 1 to 3 of 3

conditional format data point in scatter plot

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    Nottingham,England
    MS-Off Ver
    Excel 2010
    Posts
    2

    conditional format data point in scatter plot

    I've been trying for some time to write some code to conditionally format data points in a scatter plot.

    The following is an extract which formats the data point style for a range of data series, not very tidy I know, but it works. I wanted to control the data point style and size of series 1-29, 29-58 etc. I know hard coding is never a good idea, but it was the best I could do.

    Data labels are switched off because there are too many and the chart was crowded, however I do want the data labels to show if the sum of x-co-ord muliplied by y co-ord is greater than a stated figure

    x vals are decimals between 1 and 5
    y vals are decimals between 1 and 5

    I want all data points where x times y >20 to have the data labels switched on.

    Any suggestions would be great

    Extract of existing code as follows, remainder just repeats for the for the next x series and applies a different data point style

    Thanks

    Private Sub Chart_Activate()
    Application.ScreenUpdating = False

    Dim Answer As String
    Dim MyNote As String

    'Place your text here
    MyNote = "Do you want to update the chart?"

    'Display MessageBox
    Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Chart Update")

    If Answer = vbNo Then
    'Code for No button Press
    'MsgBox "You pressed NO!"
    Else
    'Code for Yes button Press
    'Regulatory

    Dim i As Integer
    total = 0

    For i = 1 To 29


    ActiveChart.SeriesCollection(i).Select
    Selection.MarkerStyle = 3
    Selection.MarkerSize = 6
    MarkerBackgroundColorIndex = 3

    ActiveChart.SeriesCollection(i).ApplyDataLabels
    ActiveChart.SeriesCollection(i).DataLabels.Select
    Selection.ShowSeriesName = False
    Selection.ShowValue = False


    Next i

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: conditional format data point in scatter plot

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Conditional formatting of chart data is often done by creating a separate data series and building the source data table with formulas.

    Put code tags in your code and then post a sample workbook to illustrate what you want to achieve. There may be alternatives to VBA.

  3. #3
    Registered User
    Join Date
    07-27-2011
    Location
    Nottingham,England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: conditional format data point in scatter plot

    Sorry, obviously didn't read the rules properly original post shown here again with code tags

    I've been trying for some time to write some code to conditionally format data points in a scatter plot.

    The following is an extract which formats the data point style for a range of data series, not very tidy I know, but it works. I wanted to control the data point style and size of series 1-29, 29-58 etc. I know hard coding is never a good idea, but it was the best I could do.

    Data labels are switched off because there are too many and the chart was crowded, however I do want the data labels to show if the sum of x-co-ord muliplied by y co-ord is greater than a stated figure

    x vals are decimals between 1 and 5
    y vals are decimals between 1 and 5

    I want all data points where x times y >20 to have the data labels switched on.

    Any suggestions would be great

    Extract of existing code as follows, remainder just repeats for the for the next x series and applies a different data point style

    Thanks

    I've attached a copy of the spread sheet with all identifying information removed, what I want is to automatically attach data point labels to every data point in the top right hand corner, ie everything with a risk score >20

    Please Login or Register  to view this content.
    Last edited by adam1630; 08-03-2011 at 06:46 AM. Reason: forgot to attach file

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1