Basic principles
Let's look at a very basic XY data visualization use case to understand the most important concepts of LightningChart Python:
import lightningchart as lc
lc.set_license('my-license-key')
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]
chart = lc.ChartXY()
series = chart.add_line_series()
series.add(x, y)
chart.open()
- Firstly, the
lightningchartlibrary must be imported. For convenience, import aliaslcis used. - In order to display the charts, you must provide your personal license key with
lc.set_license - Next, we define the data for this example, i.e., lists of
xandyvalues. - To visualize this data,
ChartXYis created and its reference is stored into a variablechart - We want to visualize the data as a line, so we create a line series for
ChartXYwithchart.add_line_series. We also save the series reference into variableseries xandydata points can be added to the series byseries.add(x, y).- Some chart and series types have different APIs for adding data. See each features page for examples.
- Finally, the chart can be displayed by
chart.open().- For more display options, see Displaying charts.