Source code for lightningchart_trader.drawing_tools.freeform_line

from lightningchart_trader.drawing_tools import DrawingToolBase


[docs] class FreeformLine(DrawingToolBase): def __init__(self, trader): super().__init__(trader) self.instance.send( self.id, 'addFreeformLine', {'traderID': trader.id}, )
[docs] def get_data(self): """Gets all data point values used to draw the Freeform Line. Note: This method should be used after the chart is opened with the open() method. Returns: list: An array containing X-values and Y-values arrays. """ return self.instance.get(self.id, 'getFreeformLineData', {})
[docs] def set_data(self, x_values: list[int | float], y_values: list[int | float]): """Programmatically sets data points for the Freeform Line. Args: x_values (list[int | float]): X-values for the data points. y_values (list[int | float]): Y-values for the data points. """ self.instance.send(self.id, 'setFreeformLineData', {'xValues': x_values, 'yValues': y_values}) return self
[docs] def set_line_color(self, color: str): """Sets the color of the Freeform Line. Args: color (str): New line color as string, should be in HEX format e.g. #FFFFFF. """ self.instance.send(self.id, 'setLineColor', {'color': color}) return self
[docs] def set_line_width(self, width: int | float): """Sets the width of the Freeform Line. Args: width (int | float): New line width. """ self.instance.send(self.id, 'setLineWidth', {'width': width}) return self