I am getting data in json format as below
<?php $monthlyParticipation='[{"project_title":"test project 44","project_ref_id":"113","amount":"13000.00","months":"Feb"},{"project_title":"sdsdsd","project_ref_id":"112","amount":"50000.00","months":"Mar"},{"project_title":"testing123","project_ref_id":"104","amount":"232323.00","months":"Mar"},{"project_title":"hello wolrd","project_ref_id":"111","amount":"30000.00","months":"Mar"},{"project_title":"road construction","project_ref_id":"108","amount":"1000.00","months":"Apr"},{"project_title":"sdsdsd","project_ref_id":"112","amount":"2000.00","months":"Apr"},{"project_title":"sdsdsd","project_ref_id":"112","amount":"354357.00,30000.00","months":"May"}]'; ?>
The months has to represented in x-axis.
In y-axis, project_title as name under series
,
amount as data under series
I have tried the below code https://jsfiddle.net/neb22v3j/1/
But the graph generated is incorrect. It doesnt match with the json data
The x-axis must be the month y-axis should display the amount against the project_title. What I tried is giving the amount of a month to some other month. The amount is not relevant to the month under which it is displaying.
Please help me to fix the issue
For your point to be assigned to the correct month you have to pass
null
as the value for all the months that don't have data.I wrote a new function to parse the data that sets the datapoint value to
null
if the project doesn't have a value for the current month. (check the comments in the code)JSfiddle
I guess the answer to your question is here