Container ================================== This example demonstrates the use of wavInit and wavAddSample for waveform display, and how to place labels using the label function. Any button can be used to display a waveform. The call to wavInit sets up certain specially named attributes in the button. `View demoWaveform.psi in your browser <_static/demoWaveform.psi>`_ or :download:`Download demoWaveform.psi <_static/demoWaveform.psi>` Setting the waveform area | The waveform is displayed in the insets rectangle | ``wavButton.insets = { .25, .1, 0, .1 };`` leaves room for x axis labels on the bottom and a general label of the graph on top, as well as a big area to the left for labeling the y axis. | ``wavButton.color = { 0, 1, 0, .1 };`` gives the waveform area a pale green background. Y axis labels | ``labtopy = label(wavButton, "top Y", { 0, 1 }, { -1, 0 });`` and | ``labboty = label(wavButton, "bot Y", { 0, 0 }, { -1, 0 });`` | are used to label the y axis with the maximum and minimum of the range of values displayed in the waveform. (The "top Y" and "bot Y" are just placeholders; the actual values are set later to make the program easier to read.) The x position, 0, places the labels to the left of the waveform display, and the x offset, -1, left-justifies the text so it doesn't cover the display. | The y positions, 1 and 0, place the texts at the top and bottom of the display area, and the y offset of zero vertically centers the text on the top and bottom edges of the display area.