chipsalliance / fpga-tool-perf

FPGA tool performance profiling
https://chipsalliance.github.io/fpga-tool-perf
Apache License 2.0
99 stars 28 forks source link

feat(visual): toggle toolchain visibility in performance visualization #569

Open SiyaoIsHiding opened 1 year ago

SiyaoIsHiding commented 1 year ago

Regarding this issue #402

First, the json.gz file you give me will fail the make build process because some records do not have the property versions or family. Therefore, I added the following codes:

results['versions'] if 'versions' in results else {}, results['family'] if 'family' in results else {}, results['device']

Second, I tried to achieve the functionality to toggle the visibility by clicking the LINES instead of the legend, but I failed. I made a workaround to toggle by clicking the legend.

Something like this in the chart configuration won't work

interaction: {
        mode: 'index',
        intersect: false,
        axis: 'x',
        onHover: function (event, chartElement) {
          console.log("hover"); // no log
        },
        onClick: function (event, chartElement) {
          console.log("click");  // no log either
        }
      }

Something like this won't work either

function clickHandler(click){
    const points = myChart.getElementsAtEventForMode(click, 'nearest', { intersect: true}, true);
    console.log(points); // always an empty array
}
myChart.canvas.onclick = clickHandler;

Hope you find the workaround acceptable.

tmichalak commented 1 year ago

@SiyaoIsHiding thanks, I will take a look. A quick comment would be to fix the formatting errors reported by the CI .

SiyaoIsHiding commented 1 year ago

@SiyaoIsHiding thanks, I will take a look. A quick comment would be to fix the formatting errors reported by the CI .

Thx for your advice. It should be able to pass the yapf format check now.

SiyaoIsHiding commented 1 year ago

@tmichalak He says "disable ALL the lines corresponding to the particular toolchain." I assume he means disable the corresponding line in all the graphs. If you want to only select/deselect a single line, that would be easy to achieve. May I confirm what you want?

Besides, I would not be able to achieve the functionality that triggered by clicking a data point instead of a legend. I tried and I failed, as explained above.