Hi,
I am trying to plot a line in chart from origin. In below image lines are starting from 8AM. can we plot 7AM at the origin of both axis, so all lines will start from origin 0. here I am trying to show data from 7AM to 8AM right now it is from 8AM. so at starting point it should be start from 0.
Is this possible with line chart
1 Answer, 1 is accepted
Hi Aswini,
From what I understand, you want the lines to start from the vertical axis. If that is the case, you can set the "min" value of the ChartValueAxistItem to the time from where you want the axis to start:
I have created a very simple example demonstrating how the "min" property can be used for achieving the desired result:
<ChartValueAxis>
<ChartValueAxisItem min={1} />
If you have something different in mind, please do not hesitate to get back to us.
Regards,
Konstantin Dikov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
K9yqkg (forked) - StackBlitz
As I have implemented in above stackbliz example can we move 7AM to start of x axis. As here I am showing ChartCategoryAxisItem can we implement same
With the string values you can set the "min" property to "0.5", which will push the start point to the YAxis:
<ChartCategoryAxis>
<ChartCategoryAxisItem
categories={categoriesVal}
min={0.5}
labels={{
font: '9px Honeywell Sans Web',
}}
/>
Hi Ashwini,
Although that there is no built-in way for changing the position of the tooltip in the requested way, you can use a custom solution with PopupPropsContext and a wrapping element around the Chart (although that this could be replaced with the Chart element). Using the popup context you can handle the onOpen and onPosition events to manually set the "top" position of the tooltip based on the position of the wrapping element within the page. I have created a simple example demonstrating such implementation:
Hope this helps.
Hi,
I am trying with above suggestion this is not working with my code base, below error shown and also for document.querySelector also it throws error. Any other way to make it work
In above example I have used tsx file instead of jsx. it is showing error for .style as shown in below image, but still it working here. In my codebase it is not at working
In below image I have used ! to remove error, but my code crashes when I added above suggested changes
You can explicitly cast the element to HTMLDivElement:
let toolTip = document.querySelector('.custom-tooltip') as HTMLDivElement; toolTip.style.top = offset + 'px';
As for why the code crashes in your example, it will be difficult to guess what could be causing it. I would suggest checking for any errors or ensuring that you have added the class name and the wrapping element in the same way as in the example.
If the issue persists, please try to reproduce the issue in an example, so we can debug it locally.
But for mobile view offset value not working properly. any other solution instead of using offset because offset is not working properly when page have scroll.
The getBoundingClientRect returns the relevant position within the viewport, so changing the position of the popup element to fixed, should handle the scenario with the scrollbars:
<style>
.custom-tooltip{
position: fixed!important;
}