How can I add x & y value in a series ?

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
aaron
Newbie
Newbie
Posts: 30
Joined: Mon Apr 17, 2023 12:00 am

How can I add x & y value in a series ?

Post by aaron » Fri Apr 21, 2023 12:58 pm

For example,
I have to add xData & yData in a series. How can I pass ?

In dot net,

objChartSeries.Add(xData, yData);

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How can I add x & y value in a series ?

Post by Marc » Fri Apr 21, 2023 2:33 pm

Hello,

If you wish to create the Chart in HTML5 directly from TeeChart for Net it will parse the javascript for you.

See:
https://github.com/Steema/TeeChart-NET- ... %20WebDemo

If you are working in javascript, here are some examples:

Code: Select all

  Chart1.addSeries(new Tee.Line()).pointer.visible=true;
  Chart1.addSeries(new Tee.Line()).pointer.visible=true;
  Chart1.addSeries(new Tee.Line()).pointer.visible=true;  
  
  Chart1.series.items[0].data.values = [7];
  Chart1.series.items[0].data.x = [10];
  
  Chart1.series.items[1].data.values = [7,14,4,21,15];
  Chart1.series.items[1].data.x = [0,1,2,5,7,];

  Chart1.series.items[2].data.values = [24];
  Chart1.series.items[2].data.x = [11];
Regards,
Marc Meumann
Steema Support

aaron
Newbie
Newbie
Posts: 30
Joined: Mon Apr 17, 2023 12:00 am

Re: How can I add x & y value in a series ?

Post by aaron » Sat Apr 22, 2023 5:17 pm

it didn't work in angular.
Attachments
data.jpg
data.jpg (23 KiB) Viewed 27975 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How can I add x & y value in a series ?

Post by Marc » Mon Apr 24, 2023 3:47 pm


aaron
Newbie
Newbie
Posts: 30
Joined: Mon Apr 17, 2023 12:00 am

Re: How can I add x & y value in a series ?

Post by aaron » Tue Apr 25, 2023 7:12 am

Not working data.x

Code: Select all

ngAfterViewInit() {
    this.tChart1 = new Tee.Chart("canvas1");

    var aLine = new Tee.Line();
    this.tChart1.addSeries(aLine);
    // this.tChart1.applyTheme("minimal");
    this.tChart1.legend.visible = false;
    this.tChart1.axes.bottom.labels.rotation = 90;
    this.tChart1.series.items[0].format.stroke.size = 3;
    aLine.smooth = 0.25;
    this.tChart1.title.text = "TeeChart for Angular";

    this._weather.dailyForecast().subscribe((res) => {
      let temp_max = res["list"].map((res) => res.main.temp_max);
      let temp_min = res["list"].map((res) => res.main.temp_min);
      let alldates = res["list"].map((res) => res.dt);

      let weatherDates = [];
      alldates.forEach((res) => {
        let jsdate = new Date(res * 1000);
        weatherDates.push(
          jsdate.toLocaleTimeString("en", {
            year: "numeric",
            month: "short",
            day: "numeric",
          })
        );
      });
      //connect to weather data
      aLine.data.values = temp_max;
      aLine.data.x = new Array(temp_min);
      for (var t = 0; t < temp_min; t++) {
        aLine.data.x[t] = temp_min[t];
      }

      aLine.data.labels = weatherDates;
      //plot chart
      this.tChart1.draw();
    });
Attachments
angular.png
angular.png (59.66 KiB) Viewed 27883 times

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: How can I add x & y value in a series ?

Post by Marc » Tue Apr 25, 2023 3:52 pm


Post Reply