We have developed and present in this work a series of algorithms that present a long-duration electrocardiogram (ECG) in a compact form of stacked beats, extracting and visualizing the basic features and facilitating the tedious and time-consuming process of ECG analysis for cardiologists. The expert system based on this representation provides detection of atypical heartbeats, precursors of cardiovascular disease, and their locations in each of the 12 leads. This system was extensively tested with two public databases, MIT-BIH arrhythmia database and China Physiological Signal Challenge (CPSC2018), showing its rapid ECG processing and high efficiency in detecting abnormalities in beat morphology. In particular, tests for atypical beats based on the CPSC2018 database revealed that the set of ECGs marked as normal contains a considerable number of leads with atypical beats. The system is used as a classifier into two classes, normal beats, and atypical beats, the latter being the precursors or indicators of cardiovascular diseases (CVD). It is considered potentially useful for routine studies in groups at high risk of CVD in early stages, as a preventive medicine tool in the public health area. The system allows an intervention of a cardiologist in the intermediate stages of ECG analysis to corroborate the diagnosis in ambiguous cases.