Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
How to use lines instead of bars in tradingview

Im using tradingview charting library and providing own data with JS API. After getting data from a server, I run the following inside the "getBars"-function:

const data = fetch_data_from_an_api();
let bars = [];
data.Data.forEach(bar => {
    if (bar.time >= from && bar.time < to) {
        bars = [...bars, {
            time: bar.time * 1000,
            low: bar.low,
            high: bar.high,
            open: bar.open,
            close: bar.close,
        }];
    }
});
onHistoryCallback(bars, {
    noData: false,
});

Each element in the array can look like this:

time: 1459814400,
close: 424.53,
high: 425,
low: 419.61,
open: 420.01,
volumefrom: 7219.7,
volumeto: 3052754.53,
conversionType: "force_direct",
conversionSymbol: ""

This draws bars in the widget. But they are "candles", because there is "close, open, low, high". In my case, I have my own data (the data above is fetched from another example-api) which only contains the "close". So the bars don't make sense in my graph. I want to draw lines instead of having bars. I attach here how it looks like when there are bars:

Widget with bars

And I attach here how it looks like when I have the same value for "close, open, low, high". As you can see it only prints some kind of dots, but they do not form a line. I also tried to only put the "close" in the array of bars, but then the graph becomes empty.

Wished lines

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!