Is there a difference between taking a chest X-ray and doing an electrocardiogram?

There are differences.

Chest X-ray photography (chest X-ray) and electrocardiogram (ECG) are two different medical examination methods used to evaluate different aspects of health. Chest X-ray photography is an imaging examination, which obtains the image of the chest by using X-ray technology. It is mainly used to evaluate the lung and chest, including observing the lung structure and detecting pneumonia, emphysema, tumor and fracture. Chest radiographs can provide a panoramic view of the lungs, heart and chest. Electrocardiogram (ECG) is an examination method to record the electrical activity of the heart. It records the electrical signals of the heart by placing electrodes on the chest, limbs and other positions, and displays the electrical activities of the heart in a graphical way. Electrocardiogram can evaluate the rhythm of the heart, the movement of the heart wall, myocardial ischemia and so on. It is usually used to detect cardiovascular diseases, such as heart disease, arrhythmia and myocardial infarction.