It is very difficult to have Japan and China both in the axis, its like having Germany and France be on the same side in the war. Maybe it could be done if Japan manages to fully puppetise them or something like that. Since their main interests were in defeating eachother in OTL since Japan's goal was to control the resources there to create their national defence state and China's main interest was in defending their borders and rebuilding after the warlord period. So they are naturall opposed and China has very little reason to join the axis since they cannot offer much at all to China due to being blockaded by the British navy, one of the countries who supported them against Japan.
For them both joining the allies, that is easier but you'd need changes to Japanese politics starting in the early 20s to make them less millitaristic, instead trying to gain resources from China with the backing of the western powers, this would require them to be more friendly to Japan and for this to work. Then once the war starts this western friendly Japan could join the allies as a sign of good will maybe in an agreement to let them extract more from China in exchange for helping the allies. In this scenario China has no reason to join the axis as prevously discussed since they cannot help them so they may join the allies in order to try to get them to help them against Japan after the war.