cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 How to pass date and time to Vizframe timeseries_line chart

0 Kudos

Hi!

I'm trying to pass date and time to Vizframe timeseries_line.

I'm trying to pass it in json format:

[{
time: new Date(year,month,day,hour,minute,second),
value: someValue
}, ...]

XML:

<viz:VizFrame id="periodMonitoringVizFrame"
	vizType='timeseries_line' legendVisible="false"
	vizProperties="{	title: {visible: false},
		                categoryAxis : {title: {visible: false}},
		                valueAxis: {title: {visible: false},
		                			label: {allowDecimals: false},
		                			axisTick: {visible: false}},
		                plotArea: {marker: {visible: false}},
		                interaction : {
						          selectability : {
						              mode : 'none'
						          }
						 	 }
		                }"
	width="100%" height="100%"
	class="sapUiSmallMarginTop"
	busy="true"
	busyIndicatorDelay="0">
	<viz:dataset>
		<viz.data:FlattenedDataset
			data="{periodMonitoringModel>/requests}">
			<viz.data:dimensions>
				<viz.data:DimensionDefinition
					name="Время" value="{periodMonitoringModel>time}" />
			</viz.data:dimensions>
			<viz.data:measures>
				<viz.data:MeasureDefinition
					name="Количество" value="{periodMonitoringModel>value}" />
			</viz.data:measures>
		</viz.data:FlattenedDataset>
	</viz:dataset>

	<viz:feeds>
		<viz.feeds:FeedItem uid="categoryAxis"
			type="Dimension" values="Время" />
		<viz.feeds:FeedItem uid="valueAxis"
			type="Measure" values="Количество" />
	</viz:feeds>
</viz:VizFrame>

With this code Vizframe displays no data:

Although I succeed with other Vizframe timeseries_line, I passed date in String "MM/dd/yyyy" format, it worked well.

Help me please, how to pass date and time to timeseries_line?

UPD: if I set data like this:

[{
time: new Date(year,month,day,hour,minute,second).getTime(),
value: someValue
}, ...]

and also add a formatter to DimensionDefinition value:

function(timestamp) {
			return new Date(timestamp);
		    }

it shows maximum value of someValue, but still shown no data:

ama_touzani13
Participant

Hello ,

Please check this example and download it to check your code :

https://sapui5.hana.ondemand.com/#/entity/sap.viz.ui5.controls.VizFrame/sample/sap.viz.sample.TimeAx...

Regards.

0 Kudos

Thank you, but in this example dates are passing in "MM/dd/yyyy" string format, and I need date with time.

ama_touzani13
Participant
0 Kudos

Did you try with timeAxis.levels property ? , like XML example below :

https://answers.sap.com/questions/316544/time-axis-values-not-shown-in-timeseriesline-chart.html

  valueAxis:{
                    title:{
                        visible: true
                    }
                },
  timeAxis:

{title:{visible: true
                    },

levels:[ 'Second', 'minute', 'hour', 'day', 'month','year'],
                    levelConfig:{
                     ...........
                        month:{formatString:'MM'},
                        year:{ formatString:'yyyy'}},
                    .........


Accepted Solutions (0)

Answers (0)