Page 1 of 1

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

Posted: Fri Apr 21, 2023 12:58 pm
by 17795639
For example,
I have to add xData & yData in a series. How can I pass ?

In dot net,

objChartSeries.Add(xData, yData);

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

Posted: Fri Apr 21, 2023 2:33 pm
by Marc
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

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

Posted: Sat Apr 22, 2023 5:17 pm
by 17795639
it didn't work in angular.

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

Posted: Mon Apr 24, 2023 3:47 pm
by Marc

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

Posted: Tue Apr 25, 2023 7:12 am
by 17795639
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();
    });

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

Posted: Tue Apr 25, 2023 3:52 pm
by Marc