SVB: Odd input for X-axis (Line Plots) - Statistica Visual Basic - Statistica - Dell Community

SVB: Odd input for X-axis (Line Plots)

SVB: Odd input for X-axis (Line Plots)

This question is not answered


I try to create line plots with SVB in Statistica (Set oAnalysis = Analysis (sc2dLinePlots, ActiveDataSet)). This works quite well, besides the fact that the values on my X-axis are the row numbers, rather than the time values from column A in my input spreadsheet. This seems to be a default setting...So after running the macro I have to go into the Graph Data Editor and change the values for X manually.

Any ideas how to assign the time values from column A in my input spreadsheet to the X-axis using SVB?

Thanks for your help!


All Replies
  • Most graphs available have an "Options 1" tab which allows you to customize titles as well as case labels (case labels being the X-axis labels for 2D line plots). Just check the option for "Display case labels" and change the "Case labels" drop-down selection to Variable and choose the variable that you want to use.

  • Many thanks, RaphaĆ«l!

    This brings me closer to what I want. I changed the code as you suggested (see bottom of this post) and the x-axis is now labeled with the time values.

    BUT the time values do not refer to the shown tick marks, so that you can't match time values to tick marks. Having 10 tick marks and 3 or even 100  time labels (depending on the number of values you skip at the Scale Values tab in the Axis Layout menu) is not convenient for data interpretation.

    By pointing the cursor at the graph line a small window with the data values pops up, indicating that the x-axis is still related to the row number. I.e. if my data entries in row number 450 are 20 (time column) and 10 (response column), the window would show x=450, y=10. Instead it should be x=20, y=10. What can I do? 

    Dim oAnalysis As Analysis
     Set oAnalysis = Analysis (sc2dLinePlots, ActiveInputDataSet)
     Dim oGraph As LinePlot2D
     Set oGraph = oAnalysis.Dialog


     With oGraph.Options
      .DisplayDefaultTitle = True
      .TitlePosition = scTitleTop
      .Title = ""
      .DisplayDefaultFootnote = False
      .Footnote = ""
      .DisplayCaseLabels =  scCaseLabelVariable
      .DisplayCaseLabelsOnOff = True
      .CaseLabelsVariable = "1"       ' Variable 1  is my time
      .DisplayTextValuesAsAxisValues = True
      .CoordinateSystem = scCoordinateStandard
      .XYAxisPosition = scAxisStandard
      .DisplayFitExpressionInTitle = scFitOptionInTitle
      .PolynomialOrder = scQuadraticOrder
      .LogBase = scLogOptionTenBase
      .DisplayProgressBar = True
      .RandomSampling = False
      .RandomSamplingMethod = scByNumberOfCase
      .RandomSamplingSubsetSize = 1
      .AxisType(scX) = scLinearScale
      .AxisType(scY) = scLinearScale
      .AxisType(scZ) = scLinearScale
      .AxisType(scV) = scLinearScale
      .AutoUpdateType = scSpreadsheetUpdate
      .SpreadSheetUpdateMethod = scAuto
      .UpdateFromDialogWhenDataChanged = True
     End With