You are viewing documentation for an older version. For current documentation - click here.

Vertical line is used as a vertical separator between blocks of data. The addChartData() function of FusionCharts PHP Class lets you create vertical lines on charts. Let's find out how to do it through the example given below:

 

# Add chart values and category names
$FC->addChartData("40800","label=Week 1");

# Add first vline
$FC->addChartData("","","color=FF0000");

# Add chart values
$FC->addChartData("31400","label=Week 2");

$FC->addChartData("26700","label=Week 3");

# Add Second vline
$FC->addChartData("","","color=00FF00");

# Add chart value
$FC->addChartData("54400","label=Week 4");

 
In the above code snippet, we add two Vertical lines to the chart. The first vline is between data values 40800 and 31400 and the second one is between values 26700 and 54400.
Earlier, we have seen that addChartData()adds data required for the chart. Now, we see that it also helps in adding vLine (Vertical Line) in the chart. But, there is a difference between these two processes. The addChartData()function used for adding a vLine should have three parameters. The first two parameters are to be kept blank, and the third parameter contains attributes (separated by delimiter) for the vLines, for example , color etc. But, when we use addChartData() for providing data to the chart, the third parameter is optional or ignored.
 
Please go through Chart XML Reference > Single Series Charts> Vertical Lines section to know more about attributes of Vertical lines and how they are applied.
 
The resultant chart would look like the image below: