Forum Discussion

GregHertling's avatar
GregHertling
New Contributor III
2 years ago

Displaying ticks as Dates in an Advanced Chart

Hi, I have an Advanced Chart where I am displaying dates.  The values, however, are stored as ticks(Long).  This is great for the bars and points, however, I need the Axis labels to be displayed as date (not Long see below).  I've tried a few versions of {V:MMM-yyyy} however, that doesn't seem to work.  I do have a business rule to work with as I'm using a secondary axis, but not sure how to target the data labels in the rule.  Any suggestions?

 

thanks,

Greg

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    I'd try to turn those values into actual DateTime objects in your DataSet, before they get to the chart.

    Btw you might want to post the configuration of that chart, otherwise people trying to help won't be able to replicate it - advanced charts are very esoteric to set up.

    • GregHertling's avatar
      GregHertling
      New Contributor III

      hi, I tried to pass the datetime values to the chart, but can't seem to do it.  I can pass as a string, but that is not helpful.  Below is the BR and Chart config.  thanks

      Dim oSeriesCollection As New XFSeriesCollection()
      
      oSeriesCollection.FillUsingCubeViewDataAdapter(si, False, String.Empty, "da_Milestones_PC", _
      	XFDataRowListType.AllRows, _
      	String.Empty, _
      	XFChartCubeViewDataPointLegendType.Default, _
      	False, XFChart2SeriesType.BarStacked, args.CustomSubstVars)
      
      For Each oSeries As XFSeries In oSeriesCollection.Series
      
      	Dim Points As List(Of XFSeriesPoint) = oSeries.Points
      	For Each Point As XFSeriesPoint In Points
      		Dim DateTime As New DateTime(Point.Value)
      		Point.Value = DateTime.ToString("yyyyMMdd")
      	Next
      
      	oSeries.ModelType = XFChart2ModelType.Bar2DFlat
      	oSeries.BarWidth = 0.75
      
      	If oSeries.UniqueName.Equals(" ") Then
      		oSeries.Color = "Transparent"
      		' oSeries.Color = XFChartDataSeries.Equals("Transparent")
      	End If
      
      	If oSeries.UniqueName.Equals("BS") Then
      		oSeries.Color = "DarkOrange"
      	End If
      
      	If oSeries.UniqueName.Equals("FCST") Then
      		oSeries.Color = "DeepSkyBlue"
      	End If
      
      	' Dim SeriesNm As String = oSeries.UniqueName
      	' BRApi.ErrorLog.LogMessage(si, $"{SeriesNm} ")
      
      	If oSeries.UniqueName.Equals("MC") Or  _
      	oSeries.UniqueName.Equals("SC") Or _
      	oSeries.UniqueName.Equals("COD") Or _
      	oSeries.UniqueName.Equals("FC") Then
      
      		oSeries.Type = XFChart2SeriesType.Point
      		oSeries.UseSecondaryAxis = True
      
      		If oSeries.UniqueName.Equals("MC") Then
      			oSeries.Color = "DarkViolet"
      		End If
      
      		If oSeries.UniqueName.Equals("SC") Then
      			oSeries.Color = "DarkCyan"
      		End If
      
      		If oSeries.UniqueName.Equals("COD") Then
      			oSeries.Color = "Red"
      		End If
      
      		If oSeries.UniqueName.Equals("FC") Then
      			oSeries.Color = "Gold"
      		End If
      
      	End If
      
      Next
      
      Return oSeriesCollection.CreateDataSet(si)
      

       

      • JackLacava's avatar
        JackLacava
        Honored Contributor

        I think the issue is that your XFSeriesPoint objects must have the ArgumentDateTime property set to a date. That property is read-only, so you cannot modify it; you would have to manually recreate the points, put them in a list, and set that list in oSeries.Points.

        That property is set automatically, if the original source adapter you're pulling uses a cube view with Time in rows or columns; so I'd suggest you try that, check how the points of those adapters are configured, and then mimic it in your rule. There are many constructors for XFSeriesPoint, pick one that expects a date passed as well as the properties you're interested in.

        This is the only way i can see, to put dates on axis. I don't know if it would suit the chart you're building though.