Cannot create property 'mirror' on string 'true' in Kendo Chart

41 views Asked by At

I am using Kendo chart in my project. This is my kendo chart html file.

<kendo-chart>
   <kendo-chart-tooltip [shared]="true"></kendo-chart-tooltip>
   <kendo-chart-legend position="bottom"></kendo-chart-legend>
   <kendo-chart-category-axis>
   <kendo-chart-category-axis-item labels="true" [line]="{visible:true}" mirror="true"
                    [categories]="categories">
   </kendo-chart-category-axis-item>
   </kendo-chart-category-axis>
           
   <kendo-chart-area background="#00000000"></kendo-chart-area>
          <kendo-chart-series>
                <kendo-chart-series-item *ngFor="let item of kapanAnaItem.planProdSeries" [data]="item.data" type="bar"
                    [name]="item.name" [color]="item.color">
                </kendo-chart-series-item>
            </kendo-chart-series>
        </kendo-chart>

Below image is my data coming from server.

enter image description here

But when this data is bind then it will give me below error.

enter image description here

I do lots of research but nothing can help me to solve this issue.

Any Help will be Appreciated...

1

There are 1 answers

0
Shai On

In the following row, the syntax labels="true" actually passes the string "true" into the input labels.

<kendo-chart-category-axis-item labels="true" [line]="{visible:true}" mirror="true"

To pass the boolean value true, you need to use the following syntax: [labels]="true".

In any case, the labels input shouldn't receive a boolean value, it should receive an object of type CategoryAxisLabels, which among other properties, contains a property named mirror.

So the problem is that you're passing the string "true" into an input that expects an object and when the component tries to access the object's mirror member, you get the error "Cannot create property 'mirror' on string 'true'".

You can see a full list of the members of the CategoryAxisLabels type in the official documentation.


By the way, CategoryAxisItemComponent doesn't have an input named mirror. Like I pointed out earlier, it's a member of the CategoryAxisLabels object, so you can remove it from kendo-chart-category-axis-item.