Skip to content

Instantly share code, notes, and snippets.

@mvladic
Created March 1, 2019 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvladic/c7e861ad7adc823fd0f6c7aa35acaff8 to your computer and use it in GitHub Desktop.
Save mvladic/c7e861ad7adc823fd0f6c7aa35acaff8 to your computer and use it in GitHub Desktop.
add_chart_sample.js
var defaultValues = {
startFrequency: 1234
};
var values = await input({
title: "Enter Start Frequency",
fields: [
{
name: "startFrequency",
unit: "frequency",
displayName: "Start frequency",
type: "number"
}
]
}, defaultValues);
connection.acquire();
await connection.command(`FREQuency:STARt ${values.startFrequency}`);
var data = await connection.query("TRACe:DATA? 1");
session.addChart({
description: "This is description",
data,
samplingRate: 1000, // 1000 samples per second
offset: 0,
scale: 1,
format: 4, // CSV string
unit: "frequency",
color: "rgb(255,250,205)", // line color on black backround
colorInverse: "rgb(51,51,0)", // line color on white background
label: "This is y-axis label"
});
connection.release();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment