Its easy to create a line-bar combination chart in chartphp with multiple axis support.

Step 1: Include Charts 4 PHP Library

include("../../lib/inc/chartphp_dist.php");
$p = new chartphp();

Step 2: Configure Data array

$linebar_bar_data =
array(
array(
array("Jan",80.25),
array("Feb",138.75),
array("Mar",185.50),
array("Apr",370.50),
array("May",266.80),
array("Jun",350),
array("Jul",245),
array("Aug",129),
array("Sep",490),
array("Oct",323),
array("Nov",255),
array("Dec",450))
);

$linebar_line_data =
array(
array(
array("Jan",145),
array("Feb",129),
array("Mar",190),
array("Apr",323),
array("May",285),
array("Jun",250),
array("Jul",245),
array("Aug",129),
array("Sep",450),
array("Oct",412),
array("Nov",185),
array("Dec",490))
);

$p->data = array($linebar_bar_data, $linebar_line_data) ;

Step 3: Set Chart type

$p->chart_type = "line-bar";

Step 4: Render Chart

$out = $p->render("c1");

For complete code, please visit our demo center.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?