ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  how to change x-Axis Label color of selected data point
Posted by Ramesh on Jan-20-2021 20:24
Attachments:
how to change x-Axis Label color of selected data point
screenshot.png

  how to change x-Axis Label color of selected data point using JavaScript
Posted by Ramesh on Jan-20-2021 20:25
how to change x-Axis Label color of selected data point using JavaScript

  Re: how to change x-Axis Label color of selected data point using JavaScript
Posted by Peter Kwan on Jan-21-2021 13:48
Hi Ramesh,

You can specify the label color using CDML. For example, instead of "abcd1234", you can use "<*color=FF0000*>abcd1234", and the color of the text will become red. See:

https://www.advsofteng.com/doc/cdnet.htm#cdml.htm

In ChartDirector, the charting code runs on the server side. If you want to change the color using Javascript, you can send a request to the server to update the chart with different colors for the labels.

The followings are some examples to change the chart. (They add/remove lines or symbols on the chart. The method is the same for any other kinds of changes to the chart.)

https://www.advsofteng.com/doc/cdnet.htm#zoomscrolltrackweb.htm
https://www.advsofteng.com/doc/cdnet.htm#financedemo.htm

In brief, you need some method to tell the server which labels should be in another color. There are several methods. The exact details depend on your web framework (eg. ASP.NET or ASP.NET Core or ASP.NET MVC ....).

In the zoomscrolltrackweb example, it stores the necessary information in custom attributes, and then it sends a "partialUpdate" request to the server. The server code is designed to handle this request and redraw the chart according to the attributes.

In the financedemo example, it just uses traditional POST to send the status of the controls to the server. You can add hidden fields to store additional information, such as the labels that need to change color.

Regards
Peter Kwan