.. highlightlang:: us .. _auto_setlegendtext: auto_SetLegendText ================== .. index:: auto_SetLegendText .. us.tag auto_SetLegendText NOTREADYENGLISH :ref:`auto_SetLegendText` creates a legend entry for 1D and 2D datasets. If the function is called without parameters, the file name from the loaded data will be used as text. .. function:: bool = auto_SetLegendText() bool = auto_SetLegendText(ssText) .. us.return **Return Value** If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0). .. us.params **Parameters** .. uparam:: ssText *ssText* is text that should be entered in the legend. .. us.comment **Comment** Legends can be created with a field function (with the exception of legends described here with the ``$LEGEND$`` placeholder in the template). A text object with the text ``@f{legend)`` can be created in the template. The field function takes the legend entries from all datasets in the diagram where the text object is found. The text, which will be returned for each dataset in the legend, can be set using the :ref:`XYSetLegendText` function. More than one legend created with field functions can appear on a template page. .. us.example **Example** :: auto_SetLegendText("Test 1") .. seealso:: :ref:`overview-automation`, :ref:`auto_LoadTemplate` :sub:`id-739510`