An azaazulene compound is provided. The azaazulene compound has formula (I) shown below. Each variable in formula (I) is defined in the specification. The compound can be used to treat cancer. The invention also provides a method for treating cancer. The method includes administering to a subject in need thereof an effective amount of one or more azaazulene compounds of formula (I).