tuhinkarmakar3882 commented on issue #20868:
URL: https://github.com/apache/echarts/issues/20868#issuecomment-2762225989

   FYI. Just found this [JSFiddle Link for 
HighCharts](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/yaxis/type-log-negative/)
 which showcases, Log Axis with Negative values. 
   
   Can we take any inspiration from here? 
   
   > At the core, the script listens for the axis initialization event. When an 
axis is created and if it is a logarithmic axis with the custom option enabled 
(allowNegativeLog: true), the extension adjusts several core functions. First, 
it disables the usual constraint that only positive values are permitted, 
allowing the chart to process negative inputs without errors.
   >
   > Two key functions are overridden: the conversion from logarithmic to 
linear space (log2lin) and its inverse (lin2log). In these functions, the 
absolute value of the input is used to perform the logarithmic transformation. 
Additionally, if the value is negative, the result of the transformation is 
negated. There are also adjustments for numbers less than 10, ensuring that the 
conversion produces a smoother transition between negative and positive values.
   >
   > Another significant change is made to how tick positions are calculated on 
the logarithmic axis. The method for determining tick marks 
(getLogTickPositions) is wrapped with custom logic that accounts for negative 
values. Instead of using the standard procedure—which would normally exclude 
negative values—the extension generates tick positions symmetrically for 
negative and positive parts of the axis, ensuring that the ticks are 
appropriately placed even when the data spans both sides of zero.
   >
   > Finally, the code demonstrates the usage of the modified axis by creating 
a Highcharts chart. In the chart configuration, the y-axis is set to a 
logarithmic type and the custom option is enabled. The data series includes a 
range of values from -1000 to 1000, illustrating how the chart can now display 
both negative and positive values on a logarithmic scale.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to