<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Darkside</title>
    <description>The latest articles on DEV Community by Darkside (@da730).</description>
    <link>https://dev.to/da730</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1435706%2Fbaf0a8c5-6dfe-4d24-adff-1114948df91a.png</url>
      <title>DEV Community: Darkside</title>
      <link>https://dev.to/da730</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/da730"/>
    <language>en</language>
    <item>
      <title>How to use the tooltip and abscissa in the vchart library?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 27 Jun 2024 08:08:14 +0000</pubDate>
      <link>https://dev.to/da730/how-to-use-the-tooltip-and-abscissa-in-the-vchart-library-5ef5</link>
      <guid>https://dev.to/da730/how-to-use-the-tooltip-and-abscissa-in-the-vchart-library-5ef5</guid>
      <description>&lt;h2&gt;
  
  
  Question title
&lt;/h2&gt;

&lt;p&gt;How to use the tooltip and abscissa in the vchart library?&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem description
&lt;/h2&gt;

&lt;p&gt;I am using the vchart library to create charts, but I am having trouble setting the tooltip and abscissa. I tried to configure the tooltip, but it did not display, even if I set it to visible.&lt;br&gt;
In addition, I also hope to be able to customize the content of the x-axis. I'm not sure if my usage is incorrect or there are other issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Firstly, regarding the configuration issue of tooltip, your setting method is correct.&lt;br&gt;
Then, regarding the issue of tooltip not taking effect, you need to check if your content is written in the wrong place. If you want to customize the content of the tooltip, you can refer to this example of vchart .&lt;br&gt;
Finally, regarding the customization of the x-axis, you can achieve it by setting the style in axes.label . You can also use formatMethod to customize the content. The specific implementation method can refer to this example of vchart .&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Documents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.visactor.io/vchart/guide/tutorial_docs/Chart_Concepts/Tooltip"&gt;VChart Tooltip User Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.visactor.io/vchart/demo/axis/style"&gt;Example of vchart Axis style settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.visactor.io/vchart/demo/tooltip/custom-tooltip"&gt;VChart Custom Tooltip Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.visactor.io/vchart/demo/axis/grid-style"&gt;VChart Axis Grid Style Example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to set the font size of title to semi in VChart for heading4?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 27 Jun 2024 07:51:11 +0000</pubDate>
      <link>https://dev.to/da730/how-to-set-the-font-size-of-title-to-semi-in-vchart-for-heading4-jnf</link>
      <guid>https://dev.to/da730/how-to-set-the-font-size-of-title-to-semi-in-vchart-for-heading4-jnf</guid>
      <description>&lt;h2&gt;
  
  
  Question title
&lt;/h2&gt;

&lt;p&gt;How to set the font size of title to semi in vchart for heading4?&lt;br&gt;
Problem description&lt;br&gt;
I am using the @visactor/vchart library for data lake visualization. However, I encountered a problem where I want to set the font size of the title in vchart to semi's heading-4 font size, but I don't know how to pass this variable in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;The new version of vchart provides a package called vchart-semi-theme, which can automatically crawl semi CSS variables on the page, so most of the color values of the chart can use this function. As for font size, although this package currently does not directly provide the function of introducing semi variables, you can manually modify the spec or register the theme to achieve the goal.&lt;br&gt;
Usage is as follows:&lt;br&gt;
First, install the vchart-semi-theme package&lt;br&gt;
Use Documentation: &lt;a href="https://visactor.io/vchart/guide/tutorial_docs/Theme/Theme_Extension"&gt;https://visactor.io/vchart/guide/tutorial_docs/Theme/Theme_Extension&lt;/a&gt;&lt;br&gt;
You can refer to some examples: &lt;a href="https://vp4y9p.csb.app/"&gt;https://vp4y9p.csb.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: Since the use of vchart-semi-theme requires crawling the CSS variables of the page, please make sure that your page contains the required semi CSS variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Documents
&lt;/h2&gt;

&lt;p&gt;VChart official website: &lt;a href="https://visactor.io/vchart"&gt;https://visactor.io/vchart&lt;/a&gt;&lt;br&gt;
VChart-semi-theme documentation: &lt;a href="https://visactor.io/vchart/guide/tutorial_docs/Theme/Theme_Extension"&gt;https://visactor.io/vchart/guide/tutorial_docs/Theme/Theme_Extension&lt;/a&gt;&lt;br&gt;
Online Demo: &lt;a href="https://vp4y9p.csb.app/"&gt;https://vp4y9p.csb.app/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to add custom content at the bottom of the tooltip card in VChart?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 27 Jun 2024 07:43:17 +0000</pubDate>
      <link>https://dev.to/da730/how-to-add-custom-content-at-the-bottom-of-the-tooltip-card-in-vchart-16he</link>
      <guid>https://dev.to/da730/how-to-add-custom-content-at-the-bottom-of-the-tooltip-card-in-vchart-16he</guid>
      <description>&lt;h2&gt;
  
  
  Problem description
&lt;/h2&gt;

&lt;p&gt;I am using VChart for programming data lake visualization and have encountered some issues. I want to add some custom content at the bottom of the tooltip card, especially a button.&lt;br&gt;
However, I found that when using vChart.renderAsync ().then, it seems that we cannot obtain the tooltip of the className we defined, and we have to wait for a while to obtain it. I do not want to implement this function through custom tooltips because I want to maintain the original component style. So, I would like to ask, is there a better solution?&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;For this issue, it can be modified on the original DOM through the updateElement callback. Here is an example code:&lt;br&gt;
&lt;code&gt;tooltip: {&lt;br&gt;
...&lt;br&gt;
updateElement: el =&amp;gt; {&lt;br&gt;
el.style.width = 'auto';&lt;br&gt;
el.style.height = 'auto';&lt;br&gt;
el.style.minHeight = 'auto';&lt;br&gt;
if (el.lastElementChild?.id !== 'test') {&lt;br&gt;
el.innerHTML = '';&lt;br&gt;
const div = document.createElement('div');&lt;br&gt;
div.id = 'test';&lt;br&gt;
div.style.width = '200px';&lt;br&gt;
div.innerText = 'test';&lt;br&gt;
div.style.color = 'red';&lt;br&gt;
el.appendChild(div);&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This code will be modified on the original DOM of the tooltip. You can choose to clear the tooltip content or keep the original content. However, it should be noted that the enterable support of the tooltip may not be ideal. When updating the tooltip location, the callback function will be executed every time.&lt;br&gt;
After upgrading to vchart1.6.0 version, you can use the updateElement function.&lt;br&gt;
The third parameter of updateElement can be taken to params.changePositionOnly. If it is true, it means that the default tooltip content has not changed. If the custom tooltip content needs to be updated synchronously with the default tooltip, you can consider filtering out the case where params.changePositionOnly is true.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results show
&lt;/h2&gt;

&lt;p&gt;After the above steps, I successfully added a button to the bottom of the tooltip card in vChart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Documents
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://visactor.io/vchart/option/barChart#tooltip.updateElement"&gt;updateElement Documentation&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to achieve the linkage effect in the vchart library?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 27 Jun 2024 07:29:03 +0000</pubDate>
      <link>https://dev.to/da730/how-to-achieve-the-linkage-effect-in-the-vchart-library-148l</link>
      <guid>https://dev.to/da730/how-to-achieve-the-linkage-effect-in-the-vchart-library-148l</guid>
      <description>&lt;h2&gt;
  
  
  Question title
&lt;/h2&gt;

&lt;p&gt;How to achieve the linkage effect of displaying the position of other charts when the mouse is moved in the vchart library?&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem description
&lt;/h2&gt;

&lt;p&gt;I encountered a problem when using the vchart library. I hope that when I move the mouse, other charts can also display their corresponding positions at the same time, that is, to achieve the linkage effect. I am not sure how to implement this function. Is there any relevant documentation for my reference?&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;This linkage effect can indeed be achieved. You need to listen to the dimensionHover event of a chart and then simulate dimensionHover for other charts.&lt;/p&gt;

&lt;p&gt;First, you need to use the on method to listen to the dimensionHover event of the chart. The detailed API usage can be referred to the vchart API .&lt;/p&gt;

&lt;p&gt;vChart.on('dimensionHover', function(params) {&lt;br&gt;
// 处理逻辑&lt;br&gt;
});&lt;br&gt;
Then, you can use the setDimensionIndex method to simulate the dimensionHover effect on other charts. Please refer to the vchart API for API details.&lt;/p&gt;

&lt;p&gt;vChart.setDimensionIndex(value, {&lt;br&gt;
// options&lt;br&gt;
});&lt;br&gt;
Among them,&lt;/p&gt;

&lt;p&gt;Value is the dimension value,&lt;br&gt;
Options is a DimensionIndexOption type of parameter that can be used to filter the axis to trigger the dimension effect, configure tooltips and crosshairs, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Documents
&lt;/h2&gt;

&lt;p&gt;vchart on API&lt;br&gt;
vchart setDimensionIndex API&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Issues with x-axis data overlap and y-axis data not being displayed when using vchart library</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 23 May 2024 03:36:48 +0000</pubDate>
      <link>https://dev.to/da730/issues-with-x-axis-data-overlap-and-y-axis-data-not-being-displayed-when-using-vchart-library-l1o</link>
      <guid>https://dev.to/da730/issues-with-x-axis-data-overlap-and-y-axis-data-not-being-displayed-when-using-vchart-library-l1o</guid>
      <description>&lt;h1&gt;
  
  
  Question title
&lt;/h1&gt;

&lt;p&gt;Issues with x-axis data overlap and y-axis data not being displayed when using vchart library&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem description
&lt;/h1&gt;

&lt;p&gt;I encountered problems when using the vchart library to create bar charts. Whether I tested it on the emulator or the real machine, the data on the x-axis (bottom axis) would overlap.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Focfdf8v9rebnap3k24pq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Focfdf8v9rebnap3k24pq.png" alt="Image description" width="784" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, I also noticed that some of the top labels of the bar chart will be moved inside the bar. Is this normal?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjos2voyliacjdcmqbt8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjos2voyliacjdcmqbt8.png" alt="Image description" width="742" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;There are the following solutions:&lt;br&gt;
Regarding the issue of overlapping data on the x-axis, it is because the sampling setting has been turned off. Originally, it was hoped that all data on the x-axis could be displayed, which resulted in data overlap. You can use a scroll bar to solve this problem and add the following configuration to the chart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;scrollBar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;orient&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bottom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;roam&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuqhh87fcskzbzocxko0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuqhh87fcskzbzocxko0.png" alt="Image description" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regarding the issue of moving the top label of the bar chart to the inside of the bar, this is because the system automatically adjusts to prevent the labels from overlapping each other. This feature can be turned off by setting the label configuration overlap to false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;overlap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveofiyqt7zxqed2hbuds.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveofiyqt7zxqed2hbuds.png" alt="Image description" width="446" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Results show
&lt;/h1&gt;

&lt;p&gt;Online demo: &lt;a href="https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-ytl8dz"&gt;https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-ytl8dz&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Documents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VChart scrollbar tutorial documentation: &lt;a href="https://www.visactor.io/vchart/guide/tutorial_docs/Chart_Concepts/Scrollbar"&gt;https://www.visactor.io/vchart/guide/tutorial_docs/Chart_Concepts/Scrollbar&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart label overlap document: &lt;a href="https://www.visactor.io/vchart/option/barChart#label.overlap"&gt;https://www.visactor.io/vchart/option/barChart#label.overlap&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart github：&lt;a href="https://github.com/VisActor/VChart"&gt;https://github.com/VisActor/VChart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to obtain the relative position of brush in the coordinate system in the vchart chart library?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Thu, 23 May 2024 02:53:26 +0000</pubDate>
      <link>https://dev.to/da730/how-to-obtain-the-relative-position-of-brush-in-the-coordinate-system-in-the-vchart-chart-library-1an6</link>
      <guid>https://dev.to/da730/how-to-obtain-the-relative-position-of-brush-in-the-coordinate-system-in-the-vchart-chart-library-1an6</guid>
      <description>&lt;h1&gt;
  
  
  Question title
&lt;/h1&gt;

&lt;p&gt;How to obtain the relative position of brush in the coordinate system in the vchart chart library?&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem description
&lt;/h1&gt;

&lt;p&gt;When I was using the vchart library, I encountered a problem. I listened to the onBrushEnd event and wanted to obtain the relative position of the area selected by the brush in the coordinate system. That is, after I drew a frame on the chart, I wanted to obtain the position range of this area on the x/y axis. I tried all the methods I could think of, but did not find the corresponding data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8mitx79v686kuxpqqm6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi8mitx79v686kuxpqqm6.png" alt="Image description" width="800" height="772"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;According to the design and usage of vchart, currently the vchart API does not directly provide this information, but it is still possible to obtain this necessary information through some other means. The specific steps are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use vchart.getAllComponents () to find the brush component&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fer2illtvzi7mcmzhbotk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fer2illtvzi7mcmzhbotk.png" alt="Image description" width="688" height="1158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the brush component, there is a property called _brushComponent. AABBBounds , which is the relative position of the checkbox in the region.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdy0gnpl6vfpd067qvupa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdy0gnpl6vfpd067qvupa.png" alt="Image description" width="624" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Similarly, with the vchart.getAllComponents () method, we can find the components for the x and y axes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qnpy54wwlaxq3lz3ya9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qnpy54wwlaxq3lz3ya9.png" alt="Image description" width="716" height="1082"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the found axis component, we can use the _scale .invert (position) method to convert the position of AABBBounds obtained in the previous step to specific values on the x and y axes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In order to prevent a very small position shift when the user clicks and accidentally triggers the brush drawing, we can also set a sizeThreshold property for the brush. This property means the checkbox size threshold, which literally means the minimum size of the box you need to draw. The brush event will only be triggered when the size of the box is greater than this threshold.&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Documents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VChart sizeThreshold configuration item: &lt;a href="https://www.visactor.io/vchart/option/barChart#brush.sizeThreshold"&gt;https://www.visactor.io/vchart/option/barChart#brush.sizeThreshold&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart github：&lt;a href="https://github.com/VisActor/VChart"&gt;https://github.com/VisActor/VChart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to clear the box selection at the end of the onbrushEnd event when using vchart?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Fri, 17 May 2024 09:21:07 +0000</pubDate>
      <link>https://dev.to/da730/how-to-clear-the-box-selection-at-the-end-of-the-onbrushend-event-when-using-vchart-2j5f</link>
      <guid>https://dev.to/da730/how-to-clear-the-box-selection-at-the-end-of-the-onbrushend-event-when-using-vchart-2j5f</guid>
      <description>&lt;h1&gt;
  
  
  Question title
&lt;/h1&gt;

&lt;p&gt;How to clear the box selection at the end of the onbrushEnd event when using vchart?&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem description
&lt;/h1&gt;

&lt;p&gt;I am using the @visactor/vchart chart library for chart development and encountered a problem. I need to clear the brush box at the end of the onbrushEnd event, but currently I have not found a suitable API to implement this requirement.&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;Currently, there is no API that directly corresponds to this requirement, but there is a relatively special implementation method that can solve this problem. The specific code is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;brushEnd&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;cs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getChart&lt;/span&gt;&lt;span class="p"&gt;()?.&lt;/span&gt;&lt;span class="nf"&gt;getAllComponents&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;brush&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;_brushComponents&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incrementalClearChild&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above solution is to retrieve all components and traverse them after triggering the'brushEnd 'event. If a component is named'brush', it will be cleared.&lt;/p&gt;

&lt;h1&gt;
  
  
  Results show
&lt;/h1&gt;

&lt;p&gt;After the code runs, you can clear the box selection after the onbrushEnd event ends.&lt;br&gt;
Online demo: &lt;a href="https://codesandbox.io/p/sandbox/grouped-bar-chart-shows-all-the-group-labels-forked-2t4jf7"&gt;https://codesandbox.io/p/sandbox/grouped-bar-chart-shows-all-the-group-labels-forked-2t4jf7&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Documents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VisActor official website: &lt;a href="https://www.visactor.io/"&gt;https://www.visactor.io/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart Events: &lt;a href="https://www.visactor.io/vchart/api/API/event"&gt;https://www.visactor.io/vchart/api/API/event&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Does VChart's multi-group bar chart support multi-layer axis labels?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Fri, 17 May 2024 08:48:01 +0000</pubDate>
      <link>https://dev.to/da730/does-vcharts-multi-group-bar-chart-support-multi-layer-axis-labels-33c1</link>
      <guid>https://dev.to/da730/does-vcharts-multi-group-bar-chart-support-multi-layer-axis-labels-33c1</guid>
      <description>&lt;h1&gt;
  
  
  Question title
&lt;/h1&gt;

&lt;p&gt;Does VChart's multi-group bar chart support multi-layer axis labels?&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem description
&lt;/h1&gt;

&lt;p&gt;I am a developer who uses the VChart chart library. Recently, I encountered a problem where I wanted to use multi-layer axis labels in multi-group bar charts, like the effect shown in the figure below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcdpcl0h9m5lrqtecblx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcdpcl0h9m5lrqtecblx.png" alt="Image description" width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;When there are multiple fields in xField in spec, bar chart grouping will be enabled. You can enable displaying all grouping axes by setting showAllGroupLayers in the x-axis of axes to true.&lt;br&gt;
You can refer to the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;spec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Category One&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;min&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;76&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;range&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;type2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A_p&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="c1"&gt;//... 其他数据项&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;xField&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;range&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;type2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;yField&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;in&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;seriesField&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;color&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;paddingInner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;bandPadding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bothEnd&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;axes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;orient&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bottom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;showAllGroupLayers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;sampling&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;tickCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;legends&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;visible&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;vchart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;VChart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;dom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CONTAINER_ID&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;vchart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;renderAsync&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// Just for the convenience of console debugging, DO NOT COPY!&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vchart&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;vchart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Results show
&lt;/h1&gt;

&lt;p&gt;The bar chart will be grouped by xField and display the labels of each group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga5rad2cs6eu0ehdz9hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fga5rad2cs6eu0ehdz9hf.png" alt="Image description" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Online demo: &lt;a href="https://codesandbox.io/p/sandbox/line-chart-single-selected-forked-hpvd3j"&gt;https://codesandbox.io/p/sandbox/line-chart-single-selected-forked-hpvd3j&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Related Documents&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VChart showAllGroupLayers configuration item: &lt;a href="https://www.visactor.io/vchart/option/barChart-axes-band#showAllGroupLayers"&gt;https://www.visactor.io/vchart/option/barChart-axes-band#showAllGroupLayers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart github：&lt;a href="https://github.com/VisActor/VChart"&gt;https://github.com/VisActor/VChart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Can we limit the default rendered lines in a vchart multi-line chart?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Wed, 08 May 2024 09:30:38 +0000</pubDate>
      <link>https://dev.to/da730/can-we-limit-the-default-rendered-lines-in-a-vchart-multi-line-chart-78p</link>
      <guid>https://dev.to/da730/can-we-limit-the-default-rendered-lines-in-a-vchart-multi-line-chart-78p</guid>
      <description>&lt;h1&gt;
  
  
  Question Title
&lt;/h1&gt;

&lt;p&gt;Can we limit the default rendered lines in a vchart multi-line chart?&lt;/p&gt;

&lt;h1&gt;
  
  
  Question Description
&lt;/h1&gt;

&lt;p&gt;While using vchart, I encountered a problem. I'm making a multiple-line chart, and I want to ask if this multi-line chart can limit the default rendered lines? For instance, can I make it only default render one line?&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;This can be achieved. You need to use the configuration item legends.defaultSelected to set the legend items that are selected by default when the legend is initialized. The element in the array is the name of the legend item. For example, you can set defaultSelected: ['Type D'], which indicates that the line with the legend item named 'Type D' will be rendered by default. Here is a complete code example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const spec = {&lt;br&gt;
type: 'line',&lt;br&gt;
data: [&lt;br&gt;
{&lt;br&gt;
id: 'line',&lt;br&gt;
values: data&lt;br&gt;
}&lt;br&gt;
],&lt;br&gt;
xField: 'year',&lt;br&gt;
yField: 'value',&lt;br&gt;
seriesField: 'name',&lt;br&gt;
legends: {&lt;br&gt;
orient: 'right',&lt;br&gt;
selectMode: 'single', // Configure legend selection mode&lt;br&gt;
defaultSelected: ['Type D'],&lt;br&gt;
title: {&lt;br&gt;
visible: true,&lt;br&gt;
text: 'Single Select'&lt;br&gt;
}&lt;br&gt;
},&lt;br&gt;
axes: [&lt;br&gt;
{&lt;br&gt;
orient: 'left',&lt;br&gt;
label: {&lt;br&gt;
inside: true,&lt;br&gt;
space: 2,&lt;br&gt;
style: {&lt;br&gt;
textBaseline: 'bottom',&lt;br&gt;
textAlign: 'start',&lt;br&gt;
fontWeight: 'bold'&lt;br&gt;
}&lt;br&gt;
},&lt;br&gt;
tick: {&lt;br&gt;
visible: false&lt;br&gt;
},&lt;br&gt;
domainLine: {&lt;br&gt;
visible: false&lt;br&gt;
},&lt;br&gt;
title: {&lt;br&gt;
visible: true,&lt;br&gt;
text: 'Axis Title'&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
]&lt;br&gt;
};&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Result
&lt;/h1&gt;

&lt;p&gt;After running the code, the multi-line chart will only render the line of 'Type D' by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1jaca6ddv0ffu0chwq1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1jaca6ddv0ffu0chwq1.png" alt="Image description" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Online demo：&lt;a href="https://codesandbox.io/p/sandbox/line-chart-legend-shape-and-color-forked-gq3gcv"&gt;https://codesandbox.io/p/sandbox/line-chart-legend-shape-and-color-forked-gq3gcv&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Relevant Documents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VChart defaultSelected configuration item: &lt;a href="https://visactor.io/vchart/option/barChart-legends-discrete#defaultSelected"&gt;https://visactor.io/vchart/option/barChart-legends-discrete#defaultSelected&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart github: &lt;a href="https://github.com/VisActor/VChart"&gt;https://github.com/VisActor/VChart&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>In vchart, how do I set the legend not to follow the gradient color and draw a rounded rectangle legend?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Wed, 08 May 2024 07:50:18 +0000</pubDate>
      <link>https://dev.to/da730/in-vchart-how-do-i-set-the-legend-not-to-follow-the-gradient-color-and-draw-a-rounded-rectangle-legend-1cel</link>
      <guid>https://dev.to/da730/in-vchart-how-do-i-set-the-legend-not-to-follow-the-gradient-color-and-draw-a-rounded-rectangle-legend-1cel</guid>
      <description>&lt;h1&gt;
  
  
  Question Title
&lt;/h1&gt;

&lt;p&gt;In vchart charts, how do I set the legend not to follow the gradient color and draw a rounded rectangle legend?&lt;/p&gt;

&lt;h1&gt;
  
  
  Question Description
&lt;/h1&gt;

&lt;p&gt;I am using vchart to make charts and have encountered two issues that I would like to ask everyone. My area chart style has been adjusted to a gradient color, but I don't want the legend color to follow the gradient of the area chart, how should I set it?&lt;/p&gt;

&lt;p&gt;In addition, I did not find in the information that the legend shape provides a rounded rectangle option, is there any other plan to implement the drawing of rounded rectangles?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtkhv452in6zl6cw2eky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqtkhv452in6zl6cw2eky.png" alt="Image description" width="454" height="58"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;Hello, these two problems can be solved through configuration.&lt;/p&gt;

&lt;p&gt;If you don't want the legend color to follow the gradient of the area chart, you can change the color of the main mark of the series by configuring the seriesMark.&lt;br&gt;
seriesMark: 'point',&lt;br&gt;
As for how to draw legends of rounded rectangles, you can set the symbolType graphic attribute of legend graphics by configuring it. The specific setting content is as follows:&lt;br&gt;
&lt;code&gt;item:{&lt;br&gt;
shape:{&lt;br&gt;
style:{&lt;br&gt;
symbolType:"M 462 282 c 0 99.405 -80.595 180 -180 180 h -540 c -99.405 0 -180 -80.595 -180 -180 v -540 c 0 -99.405 80.595 -180 180 -180 h 540 c 99.405 0 180 80.595 180 180 v 540 z"&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faoa101hzikmioht3vvo3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faoa101hzikmioht3vvo3.png" alt="Image description" width="800" height="721"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Result Show
&lt;/h1&gt;

&lt;p&gt;Online demo: &lt;a href="https://codesandbox.io/p/sandbox/line-chart-hover-forked-t74cvw?file=%2Fsrc%2Findex.ts%3A66%2C13"&gt;https://codesandbox.io/p/sandbox/line-chart-hover-forked-t74cvw?file=%2Fsrc%2Findex.ts%3A66%2C13&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Documentation
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;VChart documentation symbolType: &lt;a href="https://visactor.bytedance.net/vchart/option/barChart-legends-discrete#item.shape.style.symbolType"&gt;https://visactor.bytedance.net/vchart/option/barChart-legends-discrete#item.shape.style.symbolType&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;VChart documentation seriesMark: &lt;a href="https://visactor.bytedance.net/vchart/option/lineChart#seriesMark('point'%7C'line')%20=%20'line"&gt;https://visactor.bytedance.net/vchart/option/lineChart#seriesMark('point'|'line')%20=%20'line&lt;/a&gt;'&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to implement hover effect on points in vchart chart library?</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Wed, 08 May 2024 07:15:40 +0000</pubDate>
      <link>https://dev.to/da730/how-to-implement-hover-effect-on-points-in-vchart-chart-library-18pj</link>
      <guid>https://dev.to/da730/how-to-implement-hover-effect-on-points-in-vchart-chart-library-18pj</guid>
      <description>&lt;h1&gt;
  
  
  Title
&lt;/h1&gt;

&lt;p&gt;How to implement hover effect on points in vchart chart library?&lt;/p&gt;

&lt;h1&gt;
  
  
  Description
&lt;/h1&gt;

&lt;p&gt;I encountered a problem when using the vchart chart library for visualization development. When using the lightCharts chart library, I can easily implement the hover effect on points, but when I switch to the vchart chart library, I found that I cannot achieve the same effect with the same configuration. I set the size, color and other properties of the points in series.point:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;point: {&lt;br&gt;
interactive: true,&lt;br&gt;
zIndex: 10,&lt;br&gt;
visible: true,&lt;br&gt;
bar: { style: { fill: 'red', size: 10, }, },&lt;br&gt;
state: {&lt;br&gt;
dimension_hover: {&lt;br&gt;
size: (datum: any) =&amp;gt; { return 10; },&lt;br&gt;
fill: (datum: any) =&amp;gt; { return 'red'; }&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33fag1xmbfo439iu1omt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33fag1xmbfo439iu1omt.png" alt="Image description" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But these settings seem to have no effect in the hover state. I want to know if I am missing any important configuration or if my configuration method is incorrect.&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;In my experience, you may need to add the state property in point and add the dimension_hover property in state to achieve the special effect in the hover state. The specific code example is as follows:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;point: {&lt;br&gt;
style: {&lt;br&gt;
size: 0&lt;br&gt;
},&lt;br&gt;
state: {&lt;br&gt;
dimension_hover: {&lt;br&gt;
size: 10,&lt;br&gt;
outerBorder: {&lt;br&gt;
distance: 0,&lt;br&gt;
lineWidth: 6,&lt;br&gt;
strokeOpacity: 0.2&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here, dimension_hover defines the effect when the mouse hovers over the point, and you can adjust these settings according to your needs.&lt;/p&gt;

&lt;p&gt;You can also refer to the official demo of vchart for learning related configurations: &lt;a href="https://visactor.bytedance.net/vchart/demo/area-chart/stacked-dash-area"&gt;https://visactor.bytedance.net/vchart/demo/area-chart/stacked-dash-area&lt;/a&gt;. If you need to demonstrate or edit your code online, vchart official website editor and codesandbox are good choices. You can upload your code to these platforms and send us the link, and we will provide further assistance for you.&lt;/p&gt;

&lt;h1&gt;
  
  
  Result
&lt;/h1&gt;

&lt;p&gt;The hover effect on points in vchart was successfully implemented through the above method, and the reason why the original configuration did not take effect was found - the configuration in series.point conflicted.&lt;br&gt;
Online demo reference: &lt;a href="https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-fx4ppt"&gt;https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-fx4ppt&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Related Documents
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Vchart official website: &lt;a href="https://visactor.bytedance.net/vchart/"&gt;https://visactor.bytedance.net/vchart/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Vchart official demo: &lt;a href="https://visactor.bytedance.net/vchart/demo/area-chart/stacked-dash-area"&gt;https://visactor.bytedance.net/vchart/demo/area-chart/stacked-dash-area&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Abnormal Y-axis display in the area chart of vchart library, where lower values appear higher</title>
      <dc:creator>Darkside</dc:creator>
      <pubDate>Fri, 26 Apr 2024 06:58:12 +0000</pubDate>
      <link>https://dev.to/da730/abnormal-y-axis-display-in-the-area-chart-of-vchart-library-where-lower-values-appear-higher-2ij3</link>
      <guid>https://dev.to/da730/abnormal-y-axis-display-in-the-area-chart-of-vchart-library-where-lower-values-appear-higher-2ij3</guid>
      <description>&lt;h1&gt;
  
  
  Question Title
&lt;/h1&gt;

&lt;p&gt;Issues with Y-axis display in vchart's area chart&lt;/p&gt;

&lt;h1&gt;
  
  
  Problem Description
&lt;/h1&gt;

&lt;p&gt;I encountered an issue with display of y-axis values when using the vchart library to draw an area chart. Specifically, the visually taller chart corresponds to a smaller value. For example, I have two data points, one at 2.8w and the other at 3w6. However, on the chart, 3w6 appears visually shorter than 2.8w which I find perplexing. I do not know how to address this issue, and it hinders user experience.&lt;br&gt;
At present, the code I used is shown below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
type: 'area',&lt;br&gt;
data: {&lt;br&gt;
fields: {&lt;br&gt;
country: {&lt;br&gt;
domain: ['China', 'USA', 'EU', 'Africa'],&lt;br&gt;
sortIndex: 0&lt;br&gt;
}&lt;br&gt;
},&lt;br&gt;
values: [&lt;br&gt;
//...data values&lt;br&gt;
]&lt;br&gt;
},&lt;br&gt;
title: {&lt;br&gt;
visible: true,&lt;br&gt;
text: 'Stacked area chart of cosmetic products sales'&lt;br&gt;
},&lt;br&gt;
xField: 'type',&lt;br&gt;
yField: 'value',&lt;br&gt;
seriesField: 'country',&lt;br&gt;
legends: [{ visible: true, position: 'middle', orient: 'bottom' }],&lt;br&gt;
tooltip: {&lt;br&gt;
dimension: {&lt;br&gt;
updateContent: data =&amp;gt; {&lt;br&gt;
let sum = 0;&lt;br&gt;
data.forEach(datum =&amp;gt; {&lt;br&gt;
sum += +datum.value;&lt;br&gt;
});&lt;br&gt;
data.push({&lt;br&gt;
hasShape: 'false',&lt;br&gt;
key: 'Total',&lt;br&gt;
value: sum&lt;br&gt;
});&lt;br&gt;
return data;&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
};&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcxxg9xpdsuyma6bvvcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcxxg9xpdsuyma6bvvcm.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1noq9ffdo27b6cjo6gdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1noq9ffdo27b6cjo6gdv.png" alt="Image description" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;The key to solving this issue lies in the "stack" attribute in the area chart of the vchart library. After careful observation, I realized that the problem was due to the stacking feature of the area chart.&lt;/p&gt;

&lt;p&gt;Firstly, we need to understand the role of stacking in area charts. When stacking is enabled, values from different series will pile up. If you want to display difference or comparison between two series, you should disable stacking. However, if you want to show an overall trend that consists of two or more elements, stacking should be enabled. Therefore, whether to enable stacking or not should be based on your visualisation demands.&lt;/p&gt;

&lt;p&gt;By default, area charts enable stacking. If you think this may impact your chart interpretation, feel free to disable it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jdhi6e1y2nxa5oekl50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4jdhi6e1y2nxa5oekl50.png" alt="Image description" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
{&lt;br&gt;
type: 'area',&lt;br&gt;
//...omit remaining specs&lt;br&gt;
title: {&lt;br&gt;
visible: true,&lt;br&gt;
text: 'Stacked area chart of cosmetic products sales'&lt;br&gt;
},&lt;br&gt;
stack: false,&lt;br&gt;
xField: 'type',&lt;br&gt;
yField: 'value',&lt;br&gt;
seriesField: 'country',&lt;br&gt;
legends: [{ visible: true, position: 'middle', orient: 'bottom' }]&lt;br&gt;
};&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Result Demonstration
&lt;/h1&gt;

&lt;p&gt;With stacking disabled, the Y-axis of the chart will reflect the actual data values, avoiding visually taller charts representing smaller values.&lt;br&gt;
Check out an online demo here: &lt;a href="https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-kgj8sj"&gt;https://codesandbox.io/p/sandbox/line-chart-shows-on-the-left-most-of-canvas-forked-kgj8sj&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Relevant Documents
&lt;/h1&gt;

&lt;p&gt;Related API: &lt;a href="https://visactor.bytedance.net/vchart/option/areaChart#stack"&gt;https://visactor.bytedance.net/vchart/option/areaChart#stack&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a href="https://github.com/VisActor/VChart"&gt;https://github.com/VisActor/VChart&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
