Use legend as x-axis

I want to display a bar graph with name of plans on x-axis and their value on y-axis with filter based on the time.

This is the query I used

  $__timeGroupAlias(up.created,$__interval), as 'Plan',
  count(*) as 'Count'
FROM plans_userplan up
INNER JOIN plans_plan p ON = up.plan_id
ORDER BY $__timeGroup(up.created,$__interval)

But it says Data is missing string field

On changing to Table view, the Plan is displayed as a column

How can I have the plan name on the x-axis and their count on the y-axis?