Macro: Create smooth line graph on different sheets

Hi! I’m trying to write a macro that does a seemingly simple job:

Create a line graph that has a smooth line type for cells B1:D25. It would also be great if it can do that for every sheet in my current document, but since I have at most 5 sheets, I’m okay with manually executing the macro for each one.

I couldn’t find a lot of resources online about writing macros, so after about an hour piecing together code from random websites, here’s what I’m currently stuck on:

  1. I’m only able to create a graph for one sheet. If I attempt to create another one on a different sheet, I get the following error:
BASIC RUNTIME ERROR
An exception occured
Type: com.star.sun.uno.RuntimeException
Message: <some-weird-directory>/sc/source/ui/unoobj/chartuno.cxx:159
  1. I’m unable to create a graph that has smooth lines. I have no idea how to specify that.

Here’s my current code:

sub Borrowed

dim mRangos(0)
dim rec as new com.sun.star.awt.Rectangle

doc = ThisComponent
sheet = doc.CurrentController.ActiveSheet
charts = sheet.charts

chart_name = "MySuperGraph"
if charts.hasByName(chart_name) then
    MsgBox "Chart exists"
    exit sub
end if

cell = sheet.getCellRangeByName("B1:D25")
cursor = sheet.createCursorByRange(cell)
cursor.collapseToCurrentRegion()
mRangos(0) = cursor.RangeAddress

with rec
    .X = 6000
    .Y = 0         
    .Width = (7190 * 3)
    .Height = (3940 * 3)
end with

charts.addNewByName(chart_name, rec, mRangos, True, True)
Chart = charts.getByName("MySuperGraph").embeddedObject
Chart.Diagram = Chart.createInstance("com.sun.star.chart.LineDiagram")

end sub

Thank you so much!

Just for reference, my data looks something like this:

And the result I want to achieve is this:
expected

One chart on one sheet with different data sets:
trigonometricScenarios.ods (113.6 KB)