Add section for writing NVP subvalues (#735)
This commit is contained in:
		
				
					committed by
					
						
						Peli de Halleux
					
				
			
			
				
	
			
			
			
						parent
						
							403506abdd
						
					
				
				
					commit
					00064bc185
				
			@@ -157,4 +157,31 @@ The console output shows the different name value pairs too:
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### Writing subvalues
 | 
			
		||||
 | 
			
		||||
Similar to number arrays, different name value pairs are shown on one chart by using _subvalues_. You make a subvalue by combining a first-level name and a second-level name with a `'.'`:
 | 
			
		||||
 | 
			
		||||
``"firstLevel.secondLevel"``
 | 
			
		||||
 | 
			
		||||
The first-level name is value name for the chart. The second-level name is the name for the actual value displayed.
 | 
			
		||||
 | 
			
		||||
If you want to show all three values of acceleration on a single chart, then use each axis as a second-level (subvalue) name, ``"acceleration.x"``.
 | 
			
		||||
 | 
			
		||||
```block
 | 
			
		||||
serial.writeValue("acceleration.x", input.acceleration(Dimension.X))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
To show the values for each axis together:
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
basic.forever(() => {
 | 
			
		||||
    serial.writeValue("acceleration.x", input.acceleration(Dimension.X))
 | 
			
		||||
    serial.writeValue("acceleration.y", input.acceleration(Dimension.Y))
 | 
			
		||||
    serial.writeValue("acceleration.z", input.acceleration(Dimension.Z))
 | 
			
		||||
    basic.pause(500)
 | 
			
		||||
}) 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Each subvalue ``'x'``, ``'y'``, and ``'z'`` is displayed on the chart named ``"acceleration"`` in the Data Viewer.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/static/mb/device/data-analysis/combined-values.jpg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/static/mb/device/data-analysis/combined-values.jpg
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 39 KiB  | 
		Reference in New Issue
	
	Block a user