필터 지우기
필터 지우기

Zooming into lines to access context menu

조회 수: 2 (최근 30일)
Mehrdad Sheikholeslami
Mehrdad Sheikholeslami 2017년 2월 6일
댓글: Jan 2017년 2월 9일
Hi,
I am developing a GUI in which a context menu is assigned to each line drawn by "plot" command. One thing that needs improvement is that there are many lines and right clicking on them needs precision. Therefore, I provided a zoom capability. The problem is when I zoom, it has no effect on the width of the line and it stays as thin as before no matter how many times you zoom in. I tried to change the width of the lines, but seems like the handle is not assigned to the width of the line. Do you have any suggestions that zooming can make it easier to right click on lines?
Thanks, Mehrdad

채택된 답변

Jan
Jan 2017년 2월 9일
편집: Jan 2017년 2월 9일
If the lines conceal eachother, increasing the linewidth (or the width susceptible for detecting a right-click) will not help. In opposite, it will increase the problem.
You could move the context menu to a kind of legend. See:
I'm using a tool, which determines the nearest line, when I click in an axes. Then this line is highlighted and the space key selects the next line. Finally the right-click opens the context menu of the axes, wich is adjusted dynamically, such that it looks like it is the context menu of the selected line.
  댓글 수: 2
Mehrdad Sheikholeslami
Mehrdad Sheikholeslami 2017년 2월 9일
Thank you so much, this seems like a very good alternative and I will definitely try this. In my case, the lines are not concealing each other and I'm looking for a way to increase the width susceptible for detecting a right click. So far I know for sure set(h,'LineWidth','number') does not provide this feature. Do you know a way to change the width susceptible for detecting a right-click?
Jan
Jan 2017년 2월 9일
You can use patch objects instead of line, which increases the visible and susceptible area. And as said before: You can catch the right click in the axes, determine the nearest line and set its ContextMenu to 'Visible' -> 'on' programmatically.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ankitha Kollegal Arjun
Ankitha Kollegal Arjun 2017년 2월 9일
A suggestion on modifying the width of individual lines in a plot:
You can create a handle to the plot command and then access each line individually and modify its LineWidth property. Consider the following example:
x1 = 1:10;
y1 = x1;
y2 = x1.^2;
h = plot(x1,y1,x1,y2);
set(h(1),'LineWidth',5);
set(h(2),'LineWidth',10);
  댓글 수: 1
Mehrdad Sheikholeslami
Mehrdad Sheikholeslami 2017년 2월 9일
Thank you for the answer. I had already tried that and as I mentioned, the area that you can right click on a line for the context menu doesn't get bigger with increasing the line width.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by