How do I have a different format for multiple value axis

2 posts, 0 answers
  1. John Bowyer
    John Bowyer avatar
    31 posts
    Member since:
    Jun 2019

    Posted 21 Jan Link to this post

    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>
  2. Dimiter Topalov
    Dimiter Topalov avatar
    1279 posts

    Posted 23 Jan Link to this post

    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.
Back to Top