This members-only tutorial provides the steps to define a custom function in WordPress that outputs categories of the current post that are not children of other categories - separated by commas.
Ex.:
For a post that belong to these categories:
the function will output:
Notice how "Child Category 1" does not get included since it is a child category.
If using Oxygen, add a text component like Text or Heading. Double click the text, click Insert Data button in the top toolbar, then PHP Function Return value and put in the Function Name, wpdd_post_categories_toplevel and then click INSERT.