revintec commented on issue #20731: URL: https://github.com/apache/echarts/issues/20731#issuecomment-2645559044
> one [possible solution](https://echarts.apache.org/examples/en/editor.html?c=line-simple&code=CYRgBAvGDaIKwAYA0YBMBmZbUBYWpAA4UR04ScB2fANgQF0BuAKGFUhgy1V3yJLIVqaOk2YBncFADeYYAEMALvIBcckCkUBPAA4BTNQHIANgEsAdnsMpz8gLYGwAIklOAvhPYy5S1es26jiYWVjb2ji6o7swA9jqKpjHmHNLMYGAAHgCCGabiaqnp6QrKatCGALJJ1mCGACoArqG1AOp6wDX1ABYNnQBiAE6mnQDKSqMN5ob0aWBuSLNaOXkFcwvpxnoA5nrmwCqFRQBGMYqKMXYqTqgApE7rReJ6mwDGiu2rLiBOagBm8sYnnNZvNZucYsYEjoDrN0oohlsdgMrvJcuJ7rCwL8YgM7Ep3siABTyAYDACUEAAfIcimABnpFA0BskSQNoAwAHS2BxgADUmPShgAPEcBpTDLzJFzwrzDLVeaBoKz2fQOSV5ABJPZ6DL0fm0wUisUS8SoaUOWXythK0kqtW-LXAHUzWkedKg9JPIZ6fIwMCSFCmsAzNyMIA) And here is the answer from [DeepSeek](https://chat.deepseek.com/). Hmm, better than mine. > > ``` > tooltip: { > trigger: "axis", > formatter: (arr) => { > const dataIndex = arr[0].dataIndex; // Current x-axis index > const xCategory = option.xAxis.data[dataIndex]; // x-axis label (e.g., 'Mon') > let content = `${xCategory}<br/>`; // Start building the tooltip content > > // Loop through all series in the option > option.series.forEach((series) => { > const value = series.data[dataIndex] ?? 'N/A'; // Use 'N/A' if data is missing > content += `${series.name}: ${value}<br/>`; // Add series name and value > }); > > return content; > } > } > ``` thanks for the reply. I did come up with that solution, but it has some drawbacks(mentioned in the original post <img width="838" alt="Image" src="https://github.com/user-attachments/assets/022a68ae-5ea3-4a31-b86c-4230392ce6c6" /> -- 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]
