in Views plugin for highcharts, when working with highcharts using line, it shows irrelevant field validation.

Comments

sirish.ayyagari’s picture

any update on this ?

stovak’s picture

I can't replicate this issue. Was the chart previously another type?

Georgique’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha5

Confirming issue in alpha5. I use "Column" type chart but form wants me to fill fields for "Pie" chart.
May be chart type should be excluded from this form and be chosen when choose widget for displaying view?

Georgique’s picture

Version: 7.x-1.0-alpha5 » 7.x-1.0-alpha6
stovak’s picture

I still couldn't replicate the issue, but I made both the fields optional and not required on the 7.x-1.x-dev branch. Git the latest commit and see if that fixes the issue.

somimi’s picture

I also had to manually make the fields optional in order for the charts to work. Also, the only way I've found to make the pie chart pull in data is to first check off all the data fields I want to include in another chart type, i.e. column, and then switch over to the pie chart.

stovak’s picture

What browser are you using... may be an IE issue...???

Georgique’s picture

@stovak, I use Opera 11.61 (now 11.62) in Ubuntu 11.10.
This is the simple trouble as I understood. We have a form with a set of required fields, which are used for column charts and pie charts. Part of them is hidden depending of charts type chosen, but when I submit the form, those hidden fields are still empty. In that reason I get an error.
You made fields optional, it should resolve an issue (still didn't check latest dev version - not enough time) but I think that it is not true way (if we left those fields empty, can get errors). Which way is true - still don't know, can just suggest. One suggestion I've posted above.
Sorry for probably bad English.

somimi’s picture

I've tested on both Chrome 17.0.963.83 and Firefox 11 on a Macbook Pro.

I agree with Georgique's assessment. Though those fields are hidden depending on the chart type chosen, they are still required and thus are throwing errors regardless of which chart type is selected. Not sure why you aren't getting the errors though, stovak. The OP's screenshot is pretty much exactly what I was getting as well.

stovak’s picture

There's a slight of hand going on with Drupal form API states. When the fields are "hidden" they should not be part of the required submission.

http://randyfay.com/states

-t

wormz30’s picture

Are there any updates on this matter? I'm so anxious to get this working!

Georgique’s picture

I want to check it but need some more time, may be on next week.

jeremymcminn’s picture

Any update on this? I've finally found a charting solution that works out of the box with Views for Druapl 7 and this is the only thing holding me back - great work on the module guys, looks pretty sweet.

ngiann’s picture

If i remember well, i initially had the same problem: I could not put on Highcharts settings the line style graph. So, i in my view i temporary selected the pie style and saved it without complaints. After that i changed it back to line/column etc styles without complaints this time!
So make it as pie first and changing it to whatever after. It's still a bug, difficult to reproduce..

jeremymcminn’s picture

*EDIT* Sorry wrong thread - message delteted.

sinasalek’s picture

Confirm the issue, temporary solution is to change chart type to pie , select the field and then change it back to the desired chart type

lejon’s picture

Component: Code » API

Same problem with bar-type chart. Same fix works changing to Pie-chart type and back again.

aganz’s picture

Confirmed the workaround for any dev version right now
1. Switch to Pie
2. Enable required fields
3. Switch back to actual chart type you intend to use

scottrigby’s picture

Status: Needs work » Closed (fixed)

Comments #16-18 confirm there is a workaround in the 1.x branch. The 1.x branch will always have some quirks. Therefore making this issue as fixed.

sunnykasera3107’s picture

Issue summary: View changes

Hi all, there is a small bug in the module. That is as following.....

$form['pie'] = array(
	"#title" => t('Pie'),
	"#type" => "fieldset",
	"#states" => array(
		"visible" => array(
			"#format_chart_type" => array("value" => "pie")
		)
)

This means this fieldset will be hidden until "pie" value is being selected in "format_chart_type". And next code is...

$form['pie']['dataset_data'] = array(
      '#title' => t('Pie Pieces'),
      '#type' => 'checkboxes',
      '#options' => $highcharts_fields,
      '#required' => TRUE,
      '#default_value' => $this->options['pie']['dataset_data'],
	  '#description' => "All returned fields may be selected to be plotted on a highchart. But keep in mind, selecting text fields here may break your chart, cause death, disease and famine and quite possibly end the world as we know it. If a label exists, the field's label will be used in the legend/label."
);

It is the field in the pie fieldset. So the pie fieldset will be hidden but not be removed. And the "dataset_data" field is required so it ask for this value in any condition. So here is small patch for this.

../views_highcharts_plugin_style_highcharts.inc
Line no. 233
$form['pie']['dataset_data'] = array(
      '#title' => t('Pie Pieces'),
      '#type' => 'checkboxes',
      '#options' => $highcharts_fields,
-     '#required' => TRUE,
+   '#required' => FALSE,

$form['pie']['selected_slice'] = array(
      '#title' => t('Selected Slice'),
      '#type' => 'radios',
      '#options' => $highcharts_fields,
-     '#required' => TRUE,
+   '#required' => FALSE,

It may solve problem.