This is a migrated thread and some comments may be shown as answers.
How do I have a different format for multiple value axis
1 Answer 12 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
n/a asked on 22 Jan 2020, 02:53 AM

I have two value axis items and I would like one to be in percent and the other to be numeric.  How can I achieve this.   My current code produces the output in the image.

    <kendo-chart-value-axis-item *ngFor="let item of valueAxes" [name]="" [title]="{ text: item.title }"
                                 [max]="item.max" [majorUnit]="item.majorUnit">
      <kendo-chart-value-axis-item-labels [format]="numberFormat">
    <kendo-chart-category-axis-item [title]="xAxis_Label" [axisCrossingValue]="crossingValues">
      <!-- format="n0"-->
  <kendo-chart-legend [visible]="false"></kendo-chart-legend>
    <kendo-chart-series-item *ngFor="let series of model"
                             [categoryField]="series.category" field="value"
        <ng-template let-value="value" let-category="category">
          <!--[innerHTML]="series.dataLabel.replace('[value_1]', value.toLocaleString() ).replace('[year]', category ).replace('[series]',  ).replace('[#%]', ((value)*100).toFixed(1).toString() + '%') "-->
          <span [innerHTML]="getToolTip(value, category,, graphType  )"></span>

1 Answer, 1 is accepted

Sort by
Dimiter Topalov
Telerik team
answered on 23 Jan 2020, 12:45 PM

Hello John,

To set different formatting for separate value axis items, you can either declare the items separately with different [format] bindings, or provide the value conditionally in the ngFor loop based on the axis name or some other arbitrary custom logic, for example:

The format can come from the axis item objects too:

I hope this helps.

Dimiter Topalov
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question