Telerik Forums
Kendo UI for Angular Forum
0 answers
136 views

Hi

I have kendo chart with dynamic data and data load based on date selection when i set daily data i'm showing daily data when i set range weekly showing weekly ... like this. I'm using baseUnit function for this of course... but looks like chart is rendering 2 times.

Here is my example


<kendo-chart
  [categoryAxis]="{ categories: categories, baseUnit:baseUnit, labels: { rotation: 'auto', format: format } }"
>
  <kendo-chart-legend
    position="bottom"
    orientation="horizontal"
  ></kendo-chart-legend>
  <kendo-chart-tooltip format="{0:c}"></kendo-chart-tooltip>
  <kendo-chart-series>
    <kendo-chart-series-item
      *ngFor="let item of series"
      [type]="type"
      [line]="{ style: style }"
      [data]="item.data"
      [name]="item.name"
    >
    </kendo-chart-series-item>
  </kendo-chart-series>
</kendo-chart>

here is ts code


 public startDate: Date
  public endDate: Date
  public dateDifference = 0;
  private eodRequestBody: EndOfDayChartRequest;
  public type = "area" as SeriesType;
  public style = "smooth";
  public areaSeries = []
  public areaSeriesData: any[]
  public categories = "dateRange";
  public groupField = "fuel";
  public areaSeriesField = "totalAmount";
  public noData = false;
  public _subscription : Subscription
  public format= ""
  public baseUnit = ""


  constructor(private eodSharedService: EodSharedService,private eodService:EODService,private cdr:ChangeDetectorRef) { }
  ngOnDestroy(): void {
    this._subscription.unsubscribe();
  }

ngOnInit(): void {
  this.loadData();
}

dateDiff(startDate: Date, endDate: Date): number { //date diffirence calc
  var Time = endDate.getTime() - startDate.getTime();
  var Diff = Time / (1000 * 3600 * 24);
  return Diff;
}

loadData() {
  this._subscription = this.eodSharedService.GetUpdatedDates().subscribe(data => { //subscribing start/end date values from shared service
    this.startDate = data.startDate;
    this.endDate = data.endDate;


    this.dateDifference = this.dateDiff(this.startDate, this.endDate);
    let range = "";
    //console.log("dateDiff : "+ this.dateDifference)
    if (this.dateDifference == 0 || this.dateDifference <= 1) {range = "hourly"; this.format = "HH:mm"; this.baseUnit = "hours"}
    else if (this.dateDifference <= 14) {range = "daily";  this.format = "dd/MM"; this.baseUnit = "days"}
    else if (this.dateDifference <= 30) {range = "weekly"; this.format = "dd/MM"; this.baseUnit = "weeks"} 
    else if (this.dateDifference > 30 && this.dateDifference < 365) {range = "monthly";  this.format = "dd-MM-yyyy"; this.baseUnit = "months"}
    else if (this.dateDifference >= 365) {range = "yearly";  this.format = "yyyy"; this.baseUnit = "years"}

    this.eodRequestBody = {
      startDate: getISOStringFromDate(this.startDate),
      endDate: getISOStringFromDate(this.endDate),
      client: null,
      type:range
    };

    this.getFuelAmountsChart(this.eodRequestBody)

  });
}
  getFuelAmountsChart(eodRequestBody: EndOfDayChartRequest) {
    console.log(eodRequestBody);
    this.eodService.getEndOfDayDistrubutionOfFuel(eodRequestBody).pipe(take(1)).subscribe(
      (res) => {
        this.areaSeriesData = [];
        res.result.items.forEach(item=>{
          if(eodRequestBody.type != "weekly"){ 
            if(item.totalAmount > 0){
              item.dateRange = new Date(item.dateRange);
              this.areaSeriesData.push(item);
            }
          }
          else{
            item.dateRange = item.dateRange;
            this.areaSeriesData.push(item);
          }
        })
        console.log(JSON.stringify(this.areaSeries));
        this.areaSeries = groupBy(this.areaSeriesData, [{ field: this.groupField }]) as GroupResult[];
        this.noData = false;
        var count = res.result.items.length;
        if(count == 0){this.noData = true;}
        this.cdr.markForCheck()

      },
      (err) => {
        console.log('ERROR ON FETCHING EOD getEndOfDayDistrubutionOfFuel', JSON.stringify(err));
      }
    )
    
  }

Can you help me on this??

Thanks

Adil
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 17 Mar 2022
1 answer
136 views

Hi Telerik

I modified your example as in example Stackblitz . When i filtered one column i cannot see color changed and cannot understand is it filtered or not and also when i add new filter and then clear it all the data returns to me but in your example it should return back first filter.

Is it a bug?

 

Thanks

 

 

Svet
Telerik team
 answered on 17 Mar 2022
1 answer
217 views

Hello everyone, I have a kendo-expansionpanel defined like this:


  <kendo-expansionpanel gdArea="filters" [title]="expandedState ? initialPannelTitle : pannelTitleFilters" [(expanded)]="expandedState">

- initialPannelTitle is a simple string that doesn't need to be formatted

- pannelTitleFilters is a string that consists of multiple key: values, here's an example of how it can look (style included):

EXTRA: ALL - Initial state: executed - STAINING: all - acceptance date: today - location: milan

I've been asked to make everything that specifies the filter bold, so the result would be something like:

EXTRA: ALL - INITIAL STATE: EXECUTED - STAINING: ALL - ACCEPTANCE DATE: TODAY - LOCATION: MILAN

I am struggling to find a way to do that: [innerHTML] instead of [title] breaks the component, as it removes the styles and it doesn't make possible to expand or collapse the panel.


NOTE: the string is generated using the function below, so it'd be possible for me to put some "special characters" (eg: **) to surround the parts that need to be bolded, but I didn't find any pipe that would make the text bolded without the use of innerHTML. How can I solve this?

    for (let [key, value] of Object.entries(obj)) {
      // Filter out falsey values
      if (Boolean(value)) {
        // Manage multiselect string
        if (Array.isArray(value)) {
          let tmp = value.join();
          // Truncate string if it exceeds max length
          if (tmp.length > maxStringLenght) {
            value = tmp.substring(0, maxStringLenght).concat('...');
          } else {
            value = tmp;
          }
        }
        // eg: LOCATION: MILAN - 
        title += `${key}: ${value}${separator}`
      }
    }
    // Remove last separator
    return title.trim().substring(0, title.length - 2);
  }

Preslava
Telerik team
 answered on 17 Mar 2022
0 answers
136 views

I'm trying to adapt the kendo-stepper (with vertical position) so that I can display it as a type of collapsable between each step.

Something like this:

https://material.angular.io/components/stepper/overview

 

but I can't do it, in the image I attached a couple of examples


 

Erik
Top achievements
Rank 1
 updated question on 16 Mar 2022
1 answer
131 views

In an existing project, I need to export some part of my document as PDF, so I read the doc for the pdf export here

"3. The next step is to style the component by installing one of the available Kendo UI themes" (??!!)

My question is why should I (ré?)install a theme in order to export a PDF?

I have my existing project, that has already setup all the needed CSS, I don't need to break the existing display, why the article suggest me to install a theme ? Who does need a theme, installs a theme, I need just the PDF export. 

So, my question is, would the PDF work without installing a theme?

Valentin
Telerik team
 answered on 16 Mar 2022
1 answer
222 views
Hi! How could I show AM/PM?
https://stackblitz.com/edit/angular-vaxrrp?file=app/app.component.ts
Hetali
Telerik team
 answered on 15 Mar 2022
2 answers
373 views
Hi,
I'm trying to export a chart to PDF but I have an error in the console:

ERROR
Error: Uncaught (in promise): TypeError: Cannot read property 'bbox' of undefined
TypeError: Cannot read property 'bbox' of undefined

Here is an example on SB.

https://stackblitz.com/edit/angular-1f74zm

Any suggestions?

Thank you
B.
sanjin
Top achievements
Rank 1
Iron
 updated answer on 15 Mar 2022
0 answers
222 views

Can I access documentation for previous versions of Kendo Angular UI?

 

For, example is the source for Angular Grid API | Kendo UI for Angular (telerik.com) available in a git repository with tags for different versions of the product?

Marvin
Top achievements
Rank 2
Iron
Iron
 asked on 15 Mar 2022
0 answers
116 views


 

I am working with kendo grid menu filter.

I want to search multiple text in filter menu. I have created multiple field object from string array. and first time filter is working fine.

but if we are saving this filter in save preference.

its not populating next time the way we entered.

i am stuck here can u plz give me solution for this.

Uma
Top achievements
Rank 1
 asked on 15 Mar 2022
1 answer
143 views

This is regarding the screen reader issues that kendo-datepicker faces only on chrome.

the screen reader was able to read the whole date that has been selected in the date picker because we added a property called title.

Further tabbing to change day/month/year individually causes the screen reader to just read "selected" or "unselected" which doesn't make much sense.

 

Could you please suggest a resolution for this one?

Yanmario
Telerik team
 answered on 15 Mar 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?