wxIshiko / wxCharts

A library to create charts in wxWidgets applications
https://www.wxishiko.com/wxCharts/
MIT License
131 stars 51 forks source link

Zoom in/out Scatter plots #84

Open lhedjazi opened 5 years ago

lhedjazi commented 5 years ago

Hi Guys,

I really appreciate the effort you are putting on developing this nice library

I am wondering whether scatter plots support zoom in/out. I have seen that wxMath2Dplot provide this feature but failed to figure out it for scatter plots. Is it because wxMath2dplot is based on wxBitmap objects which natively support zooming whereas wxPanel does not?

Anyway, it would be nice to have this feature for scatter plots.

Any thoughts about doing that would be very much appreciated.

Thanks

Kvaz1r commented 5 years ago

I am wondering whether scatter plots support zoom in/out. I have seen that wxMath2Dplot provide this feature but failed to figure out it for scatter plots.

Hello. For now, there isn't such feature for scatter plot.

Is it because wxMath2dplot is based on wxBitmap objects which natively support zooming whereas wxPanel does not?

No, the main reason in that is almost all features added as needed. And since there wasn't such issue - nobody hasn't implemented it. But now it definitely will be in todo list.

Any thoughts about doing that would be very much appreciated.

Guess, I can propose small idea for quick solution . Add to wxMath2dplot a field m_isShowLine. So if this value will be setted as false then one need to draw only points.

lhedjazi commented 5 years ago

Thanks for your prompt answer.

Guess, I can propose small idea for quick solution . Add to wxMath2dplot a field m_isShowLine. So if >this value will be setted as false then one need to draw only points.

Are you refering to the m_showLine field defined in the wxMath2DPlotDataset class? the online doc says a boolean to define "Whether to show the line on the chart." any simple examples on that?

Thanks,

Kvaz1r commented 5 years ago

Are you refering to the m_showLine field defined in the wxMath2DPlotDataset class? the online doc says a boolean to define "Whether to show the line on the chart." any simple examples on that?

It's a bit slight discrepancy in the documentation. There isn't option to set this field to false now since value initialize as true in constructor directly. So there is need to add argument for this. I am going to open PR to fix it.

Kvaz1r commented 5 years ago

Open #85. If you apply this patch - just change code for creating dataset for something like this:

    wxMath2DPlotDataset::ptr dataset(new wxMath2DPlotDataset(wxColor(250, 20, 20, 0x78),
            wxColour("Grey"),wxColour("Yellow"),points,wxCHARTTYPE_LINE,true,false));
lhedjazi commented 5 years ago

Nicely done!! working perfectly. I am going to explore it more in order to see precisely how it fits my need and will be also happy to test this feature if it comes to be implemented for wxScatterPlot.

Thanks image

lhedjazi commented 5 years ago

Hi @Kvaz1r , I Need your help again :) Struggling actually with adding legend, x title and y title to the wxMath2DPlot. I am highly confused about what I need to use exactly. I have started looking into the wxChartLegendCtrl to add a legend for example but I am still failing. Is this intended to work with wxMath2DPlot? It looks like we need to create a wxLineChartDataset which in turn used through a wxChartLegendData to feed the wxChartLegendCtrl.

Are there any examples on creating legend and axes titles for wxMath2DPlot?

I appreciate your help.

Thanks,

Kvaz1r commented 5 years ago

Are there any examples on creating legend and axes titles for wxMath2DPlot?

Hi. These features are not implemented yet. Add support for legend would be easy enough since it's very similar to legend for wxLineChart. But still better to create separate issue. About label for axis and title for charts ... I opened issue #75 and #76 some time ago, but it's really hard to implement. I even haven't idea how to do it correctly. So these issues can solve only xleclercq.

lhedjazi commented 5 years ago

Thanks @Kvaz1r for clarification.

I will create a separate issue for the legend support. Hope we will have a feedback from xleclercq on axes titles.

Thanks again for your help.