First of all, legendary Pokemon can't breed.
>Pokémon in the Undiscovered egg group cannot breed whatsoever, and Ditto cannot breed with itself.
So as you can see, they will not produce an egg if you put them in a day center because they belong in the Undiscovered egg group.
>The Undiscovered Egg Group is characterized by its members' inability to breed. Other than Nidorina, Nidoqueen, and Unown, all of the Pokémon in the group are either baby Pokémon or Legendary Pokémon.
Second, whichever Pokemon you breed with Ditto, male or female, it will always be the lowest evolution form of that Pokemon.
What will hatch from the eggs?
>After walking around for a while, the Egg will hatch into a level 5 (Generation II and III) or level 1 (Generation IV onward) first-stage Pokémon of the female species' (or non-Ditto parent's) evolutionary chain.
So to answer your question, if you put a Ditto and a legendary in the day care center, they would not be compatible, as legendary Pokemon do not breed.
And if you put in a Ditto and Zoroark, you would get a Zorua, same goes for Flareon, you would get an Eevee.
Hope I helped.